SMTP configuation error

9.1.x
help

#1

Hi,I meet "A problem occurred while sending the email. Please revise your settings. (Error: Connection could not be established with host mail.yy.yy [Permission denied #13])" when testing email in the admin pages.

1.system software version are shown below:
Centos 6.7
apache 2.2.15
php 5.6.29
mysql 14.14
owncloud:9.1

2./raid5/www/html/owncloud/config/config.php

<?php
$CONFIG = array (
'instanceid' => 'oc0t6tdhzkddfsfsdfsdsp',
'passwordsalt' => 'sEHsfsdsdfswrns6WQraDkWZLi0',
'secret' => '1kl4253453453450Y+lK7E3uMiITnIM18qdITUB',
'trusted_domains' =>
array (
0 => 'XX.XX.XX.XX',
),
'datadirectory' => '/raid5/www/html/owncloud/data',
'overwrite.cli.url' => 'http://XX.XX.XX.XX/owncloud',
'dbtype' => 'mysql',
'version' => '9.1.2.5',
'dbname' => 'owncloud10',
'dbhost' => 'localhost',
'dbtableprefix' => 'oc_',
'dbuser' => 'owncloud10',
'dbpassword' => 'SKFSDFJOWFJSL',
'logtimezone' => 'UTC',
'installed' => true,
'mail_smtpmode' => 'smtp',
'mail_from_address' => 'donotreply',
'mail_domain' => 'yy.yy',
'mail_smtphost' => 'mail.yy.yy',
'mail_smtpport' => '587',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpdebug' => true,
'mail_smtpauth' => 1,
'loglevel' => 3,
'mail_smtpname' => 'donotreply@yy.yy',
'mail_smtppassword' => '8sdfj2sdf000vcodiio2',
'memcache.local' => '\OC\Memcache\APCu',

Thanks.


#2

Have you access to the mail server? Was the mail perhaps rejected? Or your host is blacklisted by the mailserver? You can try to send mails via telnet to your mailserver manually (http://www.yuki-onna.co.uk/email/smtp.html).

Alternative: use php or sendmail and install ssmtp to pass mails to a real mailserver.


#3

I can access the mail server. It is running fully functional. No blacklist.
I also can telnet to the TCP port 25 of the mailserver.
Almost everything I check and find no answer.
Maybe php or sendmail is good tips.
thanks.


#4

Hi all, I input "setenforce 0" command and solve the problem. It seems that it is the security option causing this stubborn trouble.


#5

Command “setenforce 0” via ssh will disable SeLinux security till next reboot.
Actually it is possible to disable it completely.
But why to disable it when you can configure SeLinux properly to allow to send mail?
try this command via ssh:
setsebool -P httpd_can_sendmail 1

more info here:
How to configure SeLinux in RedHat / CentOS.