Ubuntu

Postfix 沒有從實際電子郵件中接收郵件,而是從 sendmail 中接收郵件?

  • January 4, 2014

好的,所以我正在嘗試將郵件從我的 ubuntu 伺服器(我們稱之為 example.com)轉發​​到使用 postfix 的外部 gmail 帳戶。

問題是當我使用另一個 gmail 和 yahoo 帳戶向 monkey@example.com 發送郵件時,我檢查var/log/mail.info了,沒有任何顯示。

但是,當我sendmail在終端中使用並發送到相同的地址時,我會將以下內容寫入日誌以及實際發送並最終進入我的收件箱的郵件:

Jan  4 00:02:48 Machine postfix/local[6520]: 6C82DB80C4A: to=<root@example.com>, relay=local, delay=0.01, delays=0/0/0/0.01, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Jan  4 00:02:48 Machine postfix/qmgr[6497]: 6C82DB80C4A: removed
Jan  4 00:09:58 Machine postfix/pickup[6496]: B206CB80C46: uid=0 from=<root>
Jan  4 00:09:58 Machine postfix/cleanup[6540]: B206CB80C46: message-id=<20140104050958.B206CB80C46@Machine>
Jan  4 00:09:58 Machine postfix/qmgr[6497]: B206CB80C46: from=<root@example.com>, size=265, nrcpt=1 (queue active)
Jan  4 00:09:59 nightMachine postfix/smtp[6542]: B206CB80C46: to=<destemail@gmail.com>, orig_to=<monkey@example.com>, relay=gmail-smtp-in.l.google.com[74.125.142.26]:25, delay=14, delays=13/0/0.22/0.69, dsn=2.0.0, status=sent (250 2.0.0 OK 1388812199 qd7si6471164igb.62 - gsmtp)
Jan  4 00:09:59 Machine postfix/qmgr[6497]: B206CB80C46: removed

是否有一個原因?我將如何解決它?

我正在關注教程。

後綴/虛擬:

monkey@example.com destemail@gmail.com

Main.cf:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

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

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = Machine
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = example.com, Machine, localhost.localdomain, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
home_mailbox = mail/


#added the following for mail server :O!!
virtual_alias_domains = example.com 
virtual_alias_maps = hash:/etc/postfix/virtual

dig example.com mx在終端中進行查詢時的結果:

;; ANSWER SECTION:
example.com.        21600   IN      MX      10 mail.example.com.

telnet example.com 25

Connected to example.com.
Escape character is '^]'.
220 Machine ESMTP Postfix (Ubuntu)

您已將 MX 記錄設置為“mail.example.com”。這意味著當任何郵件伺服器嘗試向您發送郵件時,它們都會進行 DNS 查找以查找 mail.example.com。由於那不存在,發送系統不知道將電子郵件發送到哪裡。

要解決此問題,請執行以下兩項操作之一:

  1. 完全刪除您的 MX 記錄。只要您沒有 MX 記錄,發送系統就會改為對 example.com 進行 DNS 查找,並且由於這確實解析到執行您的郵件伺服器的伺服器,所以這將起作用。
  2. 除了 MX 記錄,還為 mail.example.com 創建一個 A 或 CNAME 記錄。

它應該看起來像他的 A 記錄:

mail     A     127.0.0.1

(當然,除了 IP 地址應該是伺服器的實際 IP,而不是環回地址)

對於 CNAME,就像這樣:

mail     CNAME example.com.

引用自:https://serverfault.com/questions/565068