10

I have recently setup a mail server on linode using Postfix, Dovecot and MySQL. I can send and receive mails from a mail client (Outlook) but any time I try to send mail with a user from a wordpress site I designed it doesn't work. Here is an output from the error log:

Oct 27 18:36:52 hostname postfix/master[29738]: reload -- version 2.11.0, configuration /etc/postfix
Oct 27 18:37:00 hostname postfix/master[29738]: terminating on signal 15
Oct 27 18:37:00 hostname postfix/master[8304]: daemon started -- version 2.11.0, configuration /etc/postfix
Oct 27 18:37:12 hostname postfix/smtpd[8309]: warning: hostname mydomain.com does not resolve to address 2a01:7e00::f03c:91ff:fecf:e7a6
Oct 27 18:37:12 hostname postfix/smtpd[8309]: connect from unknown[2a01:7e00::f03c:91ff:fecf:e7a6]
Oct 27 18:37:12 hostname postfix/smtpd[8309]: lost connection after UNKNOWN from unknown[2a01:7e00::f03c:91ff:fecf:e7a6]
Oct 27 18:37:12 hostname postfix/smtpd[8309]: disconnect from unknown[2a01:7e00::f03c:91ff:fecf:e7a6]

My main.cf file is setup so:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

append_dot_mydomain = no

readme_directory = no

smtpd_tls_cert_file=/etc/dovecot/dovecot.pem
smtpd_tls_key_file=/etc/dovecot/private/dovecot.pem
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtp_tls_security_level = may
smtpd_tls_security_level = may

dovecot
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = hostname.mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mydomain.com, hostname.mydomain.com, localhost.mydomain.com, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

message_size_limit = 20480000
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf, mysql:/etc/postfix/mysql-virtual-email2email.cf
Thomas
  • 4,155
  • 5
  • 21
  • 28
Fanan Dala
  • 201
  • 1
  • 5

1 Answers1

10

Disable IPv6

inet_protocols = ipv4

Should do the trick

Open /etc/postfix/main.cf with a text editor

Find the line inet_protocols = all

Replace all with ipv4

Restart postfix

https://clientarea.ramnode.com/knowledgebase.php?action=displayarticle&id=108

Anthony Fornito
  • 9,526
  • 1
  • 33
  • 122
  • I did that but it shows me this error now `Oct 28 11:34:22 hostname postfix/smtpd[14321]: warning: hostname mydomain.com does not resolve to address 139.162.209.129 Oct 28 11:34:22 hostname postfix/smtpd[14321]: connect from unknown[139.162.209.129] Oct 28 11:34:22 hostname postfix/smtpd[14321]: lost connection after UNKNOWN from unknown[139.162.209.129] Oct 28 11:34:22 hostname postfix/smtpd[14321]: disconnect from unknown[139.162.209.129]` – Fanan Dala Oct 28 '17 at 11:01
  • I found that the error "hostname mydomain.com does not resolve to address 139.162.209.129" was due to a mixup in my DNS records. I corrected that but now I recieve this error `postfix/smtpd[20609]: connect from localhost[127.0.0.1] lost connection after UNKNOWN from localhost[127.0.0.1] disconnect from localhost[127.0.0.1]` I can't understand why this happens as the ip "127.0.0.1" is listed among my permitted networks. – Fanan Dala Oct 28 '17 at 17:46
  • I finally found what was wrong. From the wordpress site I set the port to 25 but I changed it to 465 and now it works perfectly fine. – Fanan Dala Oct 29 '17 at 14:40