Issue : Postfix and PHPMailer

2 posts / 0 new
Last post
#1 Thu, 07/28/2016 - 09:18
jessica.j

Issue : Postfix and PHPMailer

Greetings, Everyone!

I am creating a website for my school and one last thing is missing : website send mail. I am running a beautiful server with the last Virtualmin (on Debian 8) with MySQL, and PHP 7. Everything is working fine : website and emails (both Roundcube and Thunderbird). Just PHPmail is not.

The webiste is running with Joomla 3.6 (support PHP 7) and when I run the test mail (Global Config > Mail Settings) after the proper mail values, the following error message appears: Notice: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting and Error: Test mail could not be sent.

I also have a Mautic intance and when I run the test mail after the proper configuration, the error message appears: Connection to mydomain.tld:143 Timed Out Log data: ++ Starting Swift_SmtpTransport !! Connection to mydomain:143 Timed Out (code: 0) ++ Starting Swift_SmtpTransport !! Connection to espm.life:143 Timed Out (code: 0)

The reason why I think this is related with PHPMailer is because no evidence appears on /var/log/mail.*. The request of the message doesn't get to Postfix. So I checked php.ini and I realized that sendmail_path = was commented and empty. So, I uncommented it and added first the default sendmail -t -i (as I figured in others topics on internet) then with postfix only. Restarted Apache in both situations and had no success.

I don't know what I could do. So I am here to hear from you guys.

This is the /etc/postfix/master.cfg :

smtp    inet    n       -       -       -       -       smtpd -o smtpd_sasl_auth_enable=yes
#smtp      inet  n       -       -       -       1       postscreen
#smtpd     pass  -       -       -       -       -       smtpd
#dnsblog   unix  -       -       -       -       0       dnsblog
#tlsproxy  unix  -       -       -       -       0       tlsproxy
submission inet n       -       -       -       -       smtpd
#  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
smtps     inet  n       -       -       -       -       smtpd
#  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING

#628       inet  n       -       -       -       -       qmqpd
pickup    unix  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache

maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}

uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)

ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}

submission      inet    n       -       -       -       -       smtpd -o smtpd_sasl_auth_enable=yes

This is the php.ini: [mail function]
sendmail_path = postfix
;mail.force_extra_parameters =
mail.add_x_header = On
mail.log =/home/mydomain/

This is tail /var/log/mail.log just after the request of test mail on website (nothing related) : Jul 28 11:30:25 host1 postfix/anvil[1248]: statistics: max cache size 1 at Jul 28 08:27:04
Jul 28 11:56:15 host1 postfix/master[25292]: terminating on signal 15
Jul 28 11:56:35 host1 sendmail[4593]: alias database /etc/mail/aliases rebuilt by root
Jul 28 11:56:35 host1 sendmail[4593]: /etc/mail/aliases: 3 aliases, longest 4 bytes, 37 bytes total
Jul 28 11:56:36 host1 sm-mta[4641]: starting daemon (8.14.4): SMTP+queueing@00:10:00
Jul 28 12:22:26 host1 postfix/master[7231]: fatal: bind 0.0.0.0 port 25: Address already in use
Jul 28 12:23:21 host1 postfix/postfix-script[7280]: error: unknown command: ''
Jul 28 12:23:21 host1 postfix/postfix-script[7281]: fatal: usage: postfix start (or stop, reload, abort, flush, check, status, set-permissions, upgrade-configuration)

What should I do? Anyone?

Thanks in advance, J.

Wed, 08/03/2016 - 11:21
andreychek

Howdy,

Are you able to send email from other tools, such as RoundCube, or a desktop client like Outlook or Thunderbird?

That is, is the problem just with this one application?

Also, what is the output of these commands:

netstat -an | grep :25
netstat -an | grep :143
iptables -L -n
Topic locked