I installed a SMTP server with Postfix as mail agent (on Ubuntu 12.04). Config is as follow:
$ postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
milter_default_action = accept
milter_protocol = 2
mydestination = mail.example.com, example.com, example, localhost.localdomain, localhost
myhostname = mail.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 203.80.250.0/26 192.168.200.0/24 218.213.78.192/26 59.148.211.162/32 10.0.0.0/8
myorigin = /etc/mailname
non_smtpd_milters = inet:localhost:12301
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_milters = inet:localhost:12301
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
However, weird thing happens when I try to use this SMTP on my Mac, which is in a different network than my server.
When I use Mac OS X (10.10.3)'s Mail App, it said the SMTP cannot be connected. Settings are as follow:
- Mail Server: mail.example.com
- Port: 25
- Authentication: No
- Username & Password: Empty
- Use SSL: No
However, I use telnet
in Terminal, it works:
$telnet mail.example.com 25
Trying 123.123.123.123...
Connected to mail.example.com.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix (Ubuntu)
HELO example.com
250 mail.example.com
MAIL FROM: [email protected]
250 2.1.0 Ok
RCPT TO: [email protected]
250 2.1.5 Ok
DATA
Testing
.
250 2.0.0 Ok: queued as E44CC240959
QUIT
221 2.0.0 Bye
The response looks fine to me. What Postfix settings did I miss?
p.s.
- all domains are replaced with example.com
- [email protected] is a created email account in the server
- there is also Dovecot installed
- the SMTP server is listening at 0.0.0.0:25
UPDATE The exact error message in Mail App's Mail Connection Doctor is:
Could not connect to this SMTP server. Check your network connection and that you entered the correct information in the Account preferences.
--
UPDATE And I enabled the logging of Mail App, which brings me this useful log (containing error messages):
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 220 (41 additional bytes)
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: Connected: <MFSMTPConnection: 0x7fc3dc4edae0> (Connected) account: A{SMTP - 89AD1B73-5242-45DF-99C3-10B294A5D489}
hostname: mail.example.com, port: 25, security layer: kCFStreamSocketSecurityLevelNone
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] >> EHLO (16 additional bytes)
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-mail.example.com
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-PIPELINING
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-SIZE 10240000
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-VRFY
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-ETRN
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-STARTTLS
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-ENHANCEDSTATUSCODES
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250-8BITMIME
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 250 DSN
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] >> STARTTLS (0 additional bytes)
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: [0x7fc3dc4edae0] << 220 2.0.0 (18 additional bytes)
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: Could not connect: <MFSMTPConnection: 0x7fc3dc4edae0> (Disconnected) account: A{SMTP - 89AD1B73-5242-45DF-99C3-10B294A5D489} (Error Domain=NSPOSIXErrorDomain Code=61 "The operation couldn’t be completed. Connection refused")
Jun 10 20:23:54 RaptoriMac.local Mail[413] <Debug>: Could not connect: <MFSMTPConnection: 0x7fc3dc4edae0> (Disconnected) account: A{SMTP - 89AD1B73-5242-45DF-99C3-10B294A5D489} (Error Domain=NSPOSIXErrorDomain Code=61 "The operation couldn’t be completed. Connection refused")
The error message is on the last line right after STARTTLS
command:
Could not connect: (Disconnected) account: A{SMTP - 89AD1B73-5242-45DF-99C3-10B294A5D489} (Error Domain=NSPOSIXErrorDomain Code=61 "The operation couldn’t be completed. Connection refused")
How do I solve it? I already marked allow using insecure connection
, but it still attempts to start TLS connection. I think it attempts to connect at port 465, which is blocked by firewall. Am I correct?
0 Answers