lost connection with mx.servername while performing the HELO handshake

16,834

Some mail servers are pretty strict about how you greet them, for example they could:

Reject connections where the domain provided at HELO and EHLO has neither an 'A' nor an 'MX' record in DNS

or

Reject the request when the HELO or EHLO hostname is not in fully-qualified domain or address literal form, as required by the RFC

smtp_helo_name defaults to $myhostname (which is in your main.cf set to localhost) so you can try setting it to proper host.example.com

Share:
16,834

Related videos on Youtube

JoeMoe1984
Author by

JoeMoe1984

Updated on September 18, 2022

Comments

  • JoeMoe1984
    JoeMoe1984 almost 2 years

    I am new to administering a mail server so I am at a loss when the mail server can send to certain emails like gmail, telus, and shaw but not other email addresses. Just specific ones I guess. Here is one example in the mail logs:

    <[email protected]>, relay=mx.dockyardsliving.ca[65.254.254.50]:25, delay=67513, delays=67512/0.01/0.35/0, dsn=4.4.2, status=deferred (lost connection with mx.dockyardsliving.ca[65.254.254.50] while performing the HELO handshake)

    Here is a look at my main.cf file too:

    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no
    
    append_dot_mydomain = no
    
    readme_directory = no
    
    smtpd_tls_cert_file = /etc/ssl/certs/mailserver.pem
    smtpd_tls_key_file = /etc/ssl/private/mailserver.pem
    smtpd_use_tls=yes
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    
    # information on enabling SSL in the smtp client.
    
    smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
    myhostname = localhost
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    mydestination = localhost, localhost.localdomain, , localhost
    relayhost =
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    virtual_transport = dovecot
    dovecot_destination_recipient_limit = 1
    virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
    virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
    virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
    smtpd_sasl_type = dovecot
    smtpd_sasl_path = private/auth
    smtpd_sasl_auth_enable = yes
    smtpd_tls_security_level = may
    smtpd_tls_auth_only = yes
    smtpd_recipient_restrictions =  permit_mynetworks
                                    permit_sasl_authenticated
                                    reject_unauth_destination
    

    Any idea why I can send to some emails but not others? Is there anything that looks out of order?

    UPDATE

    Ok so I changed

    myhostname = mail.website.com
    

    and Restarted the postfix service but I was now unable to receive email so I tried it with myhostname = website.com and still same thing. So I just went back to localhost for now.

    UPDATE

    So it works now. Checked the logs and the email is getting accepted at the location. Had to add the line below to main.cf

    smtp_helo_name = mail.website.com

    Thanks

    • mbrownnyc
      mbrownnyc over 10 years
      I'm really surprised how many people post questions with no question in them. So please, what's the question? It helps clarify what you're expecting, and gives answersersr less wiggle room. Take a look at the man page for main.cf to understand what the contents of main.cf. If you're new to it, it will help you learn exactly what you're dealing with.
    • JoeMoe1984
      JoeMoe1984 over 10 years
      @mbrownnyc I added the question at the end for clarity but I thought it was clear I couldn't send to specific emails.
    • JoeMoe1984
      JoeMoe1984 over 10 years
      @mbrownnyc I followed this tutorial here which helped me understand a few things about email servershttps://workaround.org/ispmail/wheezy/big-picture
    • joeqwerty
      joeqwerty over 10 years
      @JoeMoe1984 - Describing the problem and asking a question about the problem are not the same thing. It's like the difference between you telling me that you would like an ice cream cone and you asking me to get you an ice cream cone. Telling we that you would like an ice cream cone doesn't invoke any action on my part.
  • JoeMoe1984
    JoeMoe1984 over 10 years
    Ok I will check this out in a bit and let you know, Thanks.
  • JoeMoe1984
    JoeMoe1984 over 10 years
    So I tried that and I got 220 impinc04.yourhostingaccount.com NO UCE ESMTP server ready which looks like a good response. This was after I made a few changes to the main.cf file though. Will do some more testing.
  • JoeMoe1984
    JoeMoe1984 over 10 years
    So I changed the myhostname value to something more specific like mail.website.com and its possible that worked. I just want to confirm that it got to the other end first before I accept this answer.
  • JoeMoe1984
    JoeMoe1984 over 10 years
    Ok so not sure if it worked for smtp but incoming is failing. I couldn't send to the email account anymore. I updated the question. Did I do it wrong?
  • Dusan Bajic
    Dusan Bajic over 10 years
    'failing' is not much of an info, is there anything in the logs? Also, try leaving myhostname = localhost there for the moment and just add smtp_helo_name=mail.website.com
  • JoeMoe1984
    JoeMoe1984 over 10 years
    I think that did it my friend thanks.....here have a correct answer lol