Postfix 与 SendGrid '中继访问被拒绝'

Postfix 与 SendGrid '中继访问被拒绝'

我的电子邮件配置显然是正确的,但我仍然无法通过 SendGrid 从其他地方发送电子邮件。我认为问题与 ssl 配置有关,这是我在以下位置找到的内容/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 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<[192.168.1.113]>

这是我的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

这是我的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
}

我正在尝试通过 ThunderBird 发送电子邮件,但没有成功,正如我之前所说,我认为这不是问题SendGrid,它不允许外部 IP 只发送电子邮件。当我从服务器发送电子邮件时,它有效:

echo 'Test passed.' | mail -s Test-Email <email>

相关内容