Postfix 和 Gmail 中继:我无法发送电子邮件

Postfix 和 Gmail 中继:我无法发送电子邮件

我正在尝试使用 gmail 作为发件人从我的机器发送电子邮件。我已遵循此教程:https://easyengine.io/tutorials/linux/ubuntu-postfix-gmail-smtp/当我尝试从命令行发送电子邮件时:

echo "Test mail from postfix" | mail -s "Test Postfix" [email protected]

我没有收到任何错误消息,只有一封 /var/mail/root 电子邮件,其中包含以下内容:

From MAILER-DAEMON  Wed Jun  8 12:29:25 2016
Return-Path: <>
X-Original-To: root@monitor
Delivered-To: root@monitor
Received: by monitor (Postfix)
    id 68F8C22768; Wed,  8 Jun 2016 12:29:25 +0200 (CEST)
Date: Wed,  8 Jun 2016 12:29:25 +0200 (CEST)
From: MAILER-DAEMON@monitor (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: root@monitor
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
    boundary="66753226CD.1465381765/monitor"
Message-Id: <20160608102925.68F8C22768@monitor>

This is a MIME-encapsulated message.

--66753226CD.1465381765/monitor
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii

This is the mail system at host monitor.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<[email protected]>: unknown user: "user"

--66753226CD.1465381765/monitor
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; monitor
X-Postfix-Queue-ID: 66753226CD
X-Postfix-Sender: rfc822; root@monitor
Arrival-Date: Wed,  8 Jun 2016 12:29:25 +0200 (CEST)

Final-Recipient: rfc822; [email protected]
Action: failed
Status: 5.1.1
Diagnostic-Code: X-Postfix; unknown user: "user"

--66753226CD.1465381765/monitor
Content-Description: Undelivered Message
Content-Type: message/rfc822

Return-Path: <root@monitor>
Received: by monitor (Postfix, from userid 0)
    id 66753226CD; Wed,  8 Jun 2016 12:29:25 +0200 (CEST)
subject: Backup Error!
from:backup@server01
Message-Id: <20160608102925.66753226CD@monitor>
Date: Wed,  8 Jun 2016 12:29:25 +0200 (CEST)



--66753226CD.1465381765/monitor--

配置(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 = ipv4
mailbox_size_limit = 0
mydestination = monitor, localhost.localdomain, , localhost, gmail.com
myhostname = monitor
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
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

有人能帮助我吗?

谢谢

答案1

我认为在conf文件中我的目的地应该看起来像这样

mydestination = localhost, localhost.localdomain

进行更改后,你必须重新加载配置文件

service postfix reload

相关内容