Fail to send Email to Gmail ....

Posted February 17, 2019 10.2k views
EmailUbuntu 18.04

I’ve actually configured postfix as on this tutorial:
How to Install and Configure Postfix as a Send-Only SMTP Server on Ubuntu 16.04

Then, I tried Step 3 to send an Email to my Gmail account, as follows:

 echo "This is the body of the email" | mail -s "Gmail Test"

But, I always obtained the following ERROR message:

▸N 43 Mail Delivery Syst 2019-02-17 12:43   80/3112  Undelivered Mail Returned to Sender                                                                                                                      
[-- Message 43 -- 80 lines, 3112 bytes --]:
From Sun Feb 17 12:43:27 2019
Date: Sun, 17 Feb 2019 12:43:27 +0000 (UTC)
From: (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: doaccount@do-computer
Message-Id: <>

[-- #1.1 23/933 text/plain, 7bit, us-ascii --]
[-- Notification --]

This is the mail system at host

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

<>: host[] said:
    550-5.7.1 This message does not have authentication information or fails to
    pass 550-5.7.1 authentication checks. To best protect our users from spam,
    the 550-5.7.1 message has been blocked. Please visit 550-5.7.1 for more 550
    5.7.1 information. d65si10644912pfc.201 - gsmtp (in reply to end of DATA

[-- #1.2 20/806 message/delivery-status, 7bit, us-ascii --]
[-- Delivery report --]

[-- No MIME handler installed, or not applicable --]

[-- #1.3 15/507 message/rfc822 --]
[-- Undelivered Message --]

Subject: Gmail Test
To: <>
Message-Id: <>
Date: Sun, 17 Feb 2019 12:43:26 +0000 (UTC)
From: XXXXX <doaccount@do-computer>

This is the body of the email

Can anybody please give me a hand…


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Hi @jiapei1000 ,

These days there are alot of servers setup as spam mailserver. Because of that, e-mail providers like Outlook, Gmail, etc. do alot of checking before allowing anything to come in.
If you like to setup your own mailserverver, you will have to try a bit harder. :)

Some things you will have to take into account:

  1. Your FQDN needs to match your PTR - IP
  2. You will have to setup an SSL certificate (it can be a free let’s encrypt one)
  3. You will have to create DKIM keys, and sign your mail with them + add a DKIM record in your DNS
  4. You will have to create an SPF record in your DNS
  5. You will have to check your IP, most of the time this IP is on a blacklist. This will have to be removed.

So as you can see there are some things you will have to look into. This is however a great opportunity to learn something new!
I have setup more than 20+ mailservers and know alot about it, so I do also know that debugging them can be a pain.

If this is not clear enough, please tell me. I could write some tutorial about it if needed.

  • Thank you JustSomeTech…

    I added a TXT record for SPF, it seems it’s working now… At least, one of my domain Emails can receive/send Emails now… Trying to configure multiple Emails for multiple domains…

    A thorough tutorial is still expected … Thanks again…

    • Great to hear!
      If you would like to test some properties, I find mxtoolbox a create tool for debugging the first few things.

      If you want to use this mailserver in ‘production’, I do recommend you really setup all the items I gave above. Otherwise you will have problems.

      I will let you know whenever I made a tutorial (hopefully soon).

Hi all

A tutorial (still) would be great :)

I’m having some troubles sending emails. And having lot’s of problem configuring everything to send it

My goal is to send mails to my own gmail accounts, and I’m always gettings the authentication fails answer…