Eu instalei um servidor SMTP com o Postfix como agente de email (no Ubuntu 12.04). Config é como segue:
$ 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
No entanto, algo estranho acontece quando tento usar esse SMTP no meu Mac, que está em uma rede diferente do meu servidor.
Quando uso o Mail App do Mac OS X (10.10.3), ele diz que o SMTP não pode ser conectado. As configurações são as seguintes:
No entanto, uso telnet
no Terminal, funciona:
$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
A resposta parece boa para mim. Quais configurações do Postfix eu senti falta?
p.s.
UPDATE A mensagem de erro exata no Mail Connection Doctor do Mail App é:
Could not connect to this SMTP server. Check your network connection and that you entered the correct information in the Account preferences.
-
UPDATE E eu habilitei o log do Mail App, que me traz este log útil (contendo mensagens de erro):
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")
A mensagem de erro está na última linha logo após o comando STARTTLS
:
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")
Como resolvo isso? Já marquei allow using insecure connection
, mas ainda tenta iniciar a conexão TLS. Eu acho que tenta se conectar na porta 465, que é bloqueada pelo firewall. Estou correto?
Tags email postfix ubuntu email-server