Fail to send Email to Gmail ....

February 17, 2019 1.3k views
Email Ubuntu 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" myAccount@gmail.com

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 MAILER-DAEMON@mail.longervision.com Sun Feb 17 12:43:27 2019
Date: Sun, 17 Feb 2019 12:43:27 +0000 (UTC)
From: MAILER-DAEMON@mail.longervision.com (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: doaccount@do-computer
Message-Id: <20190217124327.3665B17A418@mail.longervision.com>

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

This is the mail system at host mail.longervision.com.

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

<myAccount@gmail.com>: host gmail-smtp-in.l.google.com[74.125.20.27] 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
    https://support.google.com/mail/answer/81126#authentication for more 550
    5.7.1 information. d65si10644912pfc.201 - gsmtp (in reply to end of DATA
    command)

[-- #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: <myAccount@gmail.com>
Message-Id: <20190217124326.D601A17A3D4@mail.longervision.com>
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...

Cheers
Pei

1 Answer

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).

Have another answer? Share your knowledge.