1

My email configuration is apparently right, but still I am not able to send emails, through SendGrid, from other places. I think that the problem is about ssl configuration, here is what I find in /var/log/mail.log:

Aug 26 13:42:10 google-way postfix/smtpd[6274]: connect from unknown[177.68.227.182]
Aug 26 13:42:12 google-way postfix/smtpd[6274]: Anonymous TLS connection established from unknown[177.68.227.182]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Aug 26 13:42:13 google-way postfix/smtpd[6274]: NOQUEUE: reject: RCPT from unknown[177.68.227.182]: 454 4.7.1 <mwdesenvolvimento@gmail.com>: Relay access denied; from=<contato@mwdesenvolvimento.com.br> to=<mwdesenvolvimento@gmail.com> proto=ESMTP helo=<[192.168.1.113]>

Here is my postconf -n:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
header_size_limit = 4096000
inet_interfaces = all
mailbox_size_limit = 0
mydestination = localhost
mydomain = mwdesenvolvimento.com.br
myhostname = mx.$mydomain
mynetworks = 127.0.0.0/8 104.197.230.12 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $mydomain
readme_directory = no
recipient_delimiter = +
relayhost = [smtp.sendgrid.net]:2525
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_CAfile = /etc/ssl/certs/root.mwdesenvolvimento.com.br.crt
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/mwdesenvolvimento.com.br.crt
smtpd_tls_key_file = /etc/ssl/private/mwdesenvolvimento.com.br.dec.key
smtpd_tls_loglevel = 1
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = hash:/etc/postfix/virtual_aliases
virtual_mailbox_domains = $mydomain
virtual_transport = lmtp:unix:private/dovecot-lmtp

Here is my doveconf -n:

# 2.2.13: /etc/dovecot/dovecot.conf
# OS: Linux 3.16.0-4-amd64 x86_64 Debian 8.5 ext4
auth_mechanisms = plain login
mail_location = maildir:/var/vmail/%d/%n
namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix = 
}
passdb {
  args = scheme=CRYPT username_format=%u /etc/dovecot/users
  driver = passwd-file
}
protocols = imap lmtp
service auth-worker {
  user = $default_internal_user
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
}
service imap-login {
  inet_listener imap {
    port = 0
  }
  inet_listener imaps {
    port = 993
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0666
    user = postfix
  }
}
ssl = required
ssl_ca = </etc/ssl/certs/root.mwdesenvolvimento.com.br.crt
ssl_cert = </etc/ssl/certs/mwdesenvolvimento.com.br.crt
ssl_key = </etc/ssl/private/mwdesenvolvimento.com.br.dec.key
userdb {
  args = uid=vmail gid=vmail home=/var/vmail/%d/%n
  driver = static
}

I am trying to send the email through ThunderBird, without success, as I said before, I think it is not a SendGrid problem, it is not allowing external ip's to send emails only. When I send emails from the server, it works:

echo 'Test passed.' | mail -s Test-Email <email>
  • 1
    I'm not familiar with SendGrid, but the problems seems to be that the sender isn't trying to authenticate themselves. You'll need to configure SASL authentication for this to work. – tarleb Aug 26 '16 at 14:15
  • @tarleb but I have already done that, is there something wrong with my configurations? – FtheBuilder Aug 26 '16 at 16:33
  • The logs you included above are from receiving a message not sending. – Satō Katsura Aug 26 '16 at 17:35
  • @FtheBuilder Huh, weird. Could you add the contents of your /etc/postfix/master.cf file? You can leave out the comments (grep -v '^#' /etc/postfix/master.cf). – tarleb Aug 26 '16 at 20:05
  • @SatoKatsura Correct, the logs show that an incoming message was rejected. The reason is that mail send through the server must first be received by that same server. If we want precise terminology, the issue at hand is about mail forwarding. – tarleb Aug 26 '16 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.