none
Access denied - Invalid HELO name

    Question

  • I am using .net to send mail via smtp service in the server (windows 2003 & MS Exchnage server).
    Now a few external emails are not going out.All the internal mails are fine.

    I get this  error message in the badmail folder.


    Final-Recipient: rfc822;johnPoyne@usa.com
    Action: failed
    Status: 5.5.0
    Diagnostic-Code: smtp;550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1)

    I use localhost as the host  in the code.
    smtp.Host = "localhost"
    and in the smpt setting I use localhost's ipaddress 127.0.0.1.
    in the Masquerade Domain I put the Domain name. (like yahoo.com)
    In the fully qualified domainname i gave the server name(without the domain name).
    in the relay part, i gave both 127.0.0.1 and the IP address of the server grant permission.

    Do you see any problem why I am getting this error?
    Thanks

    Tuesday, August 24, 2010 2:43 PM

Answers

  • Hi,

     

    Please follow these steps to check the relay setting of your exchange server/SMTP service:

     

    1. Open the properties of SMTP virtual Server. In Access tab, click Relay Button.

     

    2.  Select "Only the list below", remove all IP address from the list, then add the IP address of your PC which hosing the .net program. If the .net program is running on local server, please add the IP address (NOT loopback address 127.0.0.1)

     

    3. In Delivery tab, click Advanced button, in "Full-qualified domain name", type in the FQDN of this exchange server, such as thoml.gen.com

     

    4. Open Services.msc, restart SMTP service.

     

    -----------------

    For your reference, here is a sample of relay SMTP application (C#):

     

    1. Create a Windows Application on VS.

     

    2. Add a button object to form. Double click the button and input the following codes:

     

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    using System.Net.Mail;

    using System.Net;

     

    namespace Relay

    {

        public partial class Form1 : Form

        {

            public Form1()

            {

                InitializeComponent();

            }

     

            private void button1_Click(object sender, EventArgs e)

            {

                try

                {

                    //to

                    MailMessage mailMsg = new MailMessage();

                    mailMsg.To.Add("administrator@genli.lab"); // Send the message to genli.lab

     

                    //from

                    MailAddress mailadd = new MailAddress("administrator@hotmail.com");

                    mailMsg.From = mailadd;

     

                    mailMsg.Subject = "Hi, this is a relay email";

                    mailMsg.Body = "Can you get this email";

     

                    //Init SMTP client and send

     

                    SmtpClient smtpc = new SmtpClient("thoml.gen.com", 25); // thoml.gen.com is the FQDN of your exchange server.

     

                               

                        smtpc.Send(mailMsg);

                    }

     

                    catch (Exception ex)

                    {

     

                        Console.WriteLine("Exception caught in CreateTestMessage");

                        ex.ToString();

                    }

     

     

     

                }

     

     

            }

        }

     

     


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Thanks Gen Lin-MSFT
    • Marked as answer by Gen Lin Friday, September 03, 2010 2:34 AM
    Friday, September 03, 2010 2:28 AM

All replies

  • On Tue, 24 Aug 2010 14:43:11 +0000, Jay Corona wrote:
     
    >
    >
    >I am using .net to send mail via smtp service in the server (windows 2003 & MS Exchnage server). Now a few external emails are not going out.All the internal mails are fine.
    >
    >I get this error message in the badmail folder.
    >
    >Final-Recipient: rfc822;johnPoyne@usa.com Action: failed Status: 5.5.0 Diagnostic-Code: smtp;550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1)
    >
    >I use localhost as the host in the code. smtp.Host = "localhost" and in the smpt setting I use localhost's ipaddress 127.0.0.1. in the Masquerade Domain I put the Domain name. (like yahoo.com) In the fully qualified domainname i gave the server name(without the domain name). in the relay part, i gave both 127.0.0.1 and the IP address of the server grant permission.
    >
    >Do you see any problem why I am getting this error? Thanks
     
    Not until you say what you see in the HELO\EHLO command sent by your
    code. If, as you say, you used only the name of the server, sans the
    domain name, that would qualify as the faux pas that gets your e-mail
    rejected. Use a FQDN that's resolvable in a public DNS if you're
    sending e-mail to external e-mail systems.
    ---
    Rich Matheisen
    MCSE+I, Exchange MVP
     

    --- Rich Matheisen MCSE+I, Exchange MVP
    Tuesday, August 24, 2010 9:28 PM
  • Hi,

    Have you tried to use TELNET to relay off your exchange server?

    Open CMD, type:

    telnet localhost 25

    helo

    mail from:xx@yahoo.com

    rcpt to:xx@usa.com

    Do you receive any error message?

    How to Use Telnet to Test SMTP Communication

    http://technet.microsoft.com/en-us/library/aa995718(EXCHG.65).aspx

     

     


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Thanks
    Wednesday, August 25, 2010 9:58 AM
  • Thanks for the reply!

    As per Rich’s advice, I removed all the local host entries and entered the domain name in the FQDN. Then I tried using telnet as per Gen’s advice.

    So instead of local host, I entered the ipaddress of the server. I did not get any error.

    But later I saw the mail in the badmail folder with

    “ failed Status: 5.5.0 Diagnostic-Code: smtp;550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1)” error.

     

    Question :

    “Use a FQDN that's resolvable in a public DNS if you're

    sending e-mail to external e-mail systems.”   How can I test that the FQDN I entered is right? When I click the ‘Check DNS” button it tell the domain name is valid. I am not sure I can believe that.

    Thursday, August 26, 2010 1:19 PM
  • I trying to find out what should be the FQDN of the SMTP -based on forward and reverse DSN entry.

    So I tried    nslookup  <servername>   (in the server) I get two entries.

     

    Server: ns1.sprintlink.net

    Address: <ipaddress 1>

     

    Non-Authoritative answer:

    Name :   <myserver.domain.com>

    Address:<ipaddress 2>

     

    Which address I need to enter for the FQDN.

    Thanks

    Thursday, August 26, 2010 4:56 PM
  • On Thu, 26 Aug 2010 13:19:52 +0000, Jay Corona wrote:
     
    >
    >
    >Thanks for the reply!
    >
    >As per Rich?s advice, I removed all the local host entries and entered the domain name in the FQDN. Then I tried using telnet as per Gen?s advice.
     
    His example didn't have anything after "HELO".
     
    >So instead of local host, I entered the ipaddress of the server. I did not get any error.
     
    Don't do that. The use of IP address literals is deprecated. Using
    them will just cause you problems. The only time they should be used
    is if the receiving system can't identify the sending system. IOW, if
    DNS is broken.
     
    >But later I saw the mail in the badmail folder with
    >
    >? failed Status: 5.5.0 Diagnostic-Code: smtp;550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1)? error.
     
    >Question :
    >
    >?Use a FQDN that's resolvable in a public DNS if you're
    >sending e-mail to external e-mail systems.?
     
     
    >How can I test that the FQDN I entered is right?
     
    You can use a network monitor and find the HELO\EHLO command. Or you
    can look at your SMTP protocol log (assuming you have it collecting
    more than the default set of columns of data).
     
    >When I click the ?Check DNS? button it tell the domain name is valid. I am not sure I can believe that.
     
    A name can be found in DNS, but which DNS? I'd bet your server's using
    an internal DNS. Try using bitsy.mit.edu as the DNS server in nslookup
    and see if it finds the name.
    ---
    Rich Matheisen
    MCSE+I, Exchange MVP
     

    --- Rich Matheisen MCSE+I, Exchange MVP
    Thursday, August 26, 2010 11:57 PM
  • Hi,

     

    Please follow these steps to check the relay setting of your exchange server/SMTP service:

     

    1. Open the properties of SMTP virtual Server. In Access tab, click Relay Button.

     

    2.  Select "Only the list below", remove all IP address from the list, then add the IP address of your PC which hosing the .net program. If the .net program is running on local server, please add the IP address (NOT loopback address 127.0.0.1)

     

    3. In Delivery tab, click Advanced button, in "Full-qualified domain name", type in the FQDN of this exchange server, such as thoml.gen.com

     

    4. Open Services.msc, restart SMTP service.

     

    -----------------

    For your reference, here is a sample of relay SMTP application (C#):

     

    1. Create a Windows Application on VS.

     

    2. Add a button object to form. Double click the button and input the following codes:

     

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    using System.Net.Mail;

    using System.Net;

     

    namespace Relay

    {

        public partial class Form1 : Form

        {

            public Form1()

            {

                InitializeComponent();

            }

     

            private void button1_Click(object sender, EventArgs e)

            {

                try

                {

                    //to

                    MailMessage mailMsg = new MailMessage();

                    mailMsg.To.Add("administrator@genli.lab"); // Send the message to genli.lab

     

                    //from

                    MailAddress mailadd = new MailAddress("administrator@hotmail.com");

                    mailMsg.From = mailadd;

     

                    mailMsg.Subject = "Hi, this is a relay email";

                    mailMsg.Body = "Can you get this email";

     

                    //Init SMTP client and send

     

                    SmtpClient smtpc = new SmtpClient("thoml.gen.com", 25); // thoml.gen.com is the FQDN of your exchange server.

     

                               

                        smtpc.Send(mailMsg);

                    }

     

                    catch (Exception ex)

                    {

     

                        Console.WriteLine("Exception caught in CreateTestMessage");

                        ex.ToString();

                    }

     

     

     

                }

     

     

            }

        }

     

     


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Thanks Gen Lin-MSFT
    • Marked as answer by Gen Lin Friday, September 03, 2010 2:34 AM
    Friday, September 03, 2010 2:28 AM