0

I'm trying to send emails from my machine using gmail as sender. I've followed this tutorial: https://easyengine.io/tutorials/linux/ubuntu-postfix-gmail-smtp/ and when I try to send an email from command line:

echo "Test mail from postfix" | mail -s "Test Postfix" mymail@domain.com

I don't receive any error message, only a /var/mail/root email that has:

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

<user@domain.com>: 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; user@domain.com
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--

Configuration (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

Anybody can help me?

Thanks

2

In conf file i think mydestination should look like this

mydestination = localhost, localhost.localdomain

After making changes you have to reload the conf

service postfix reload

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.