Problem sending email

Last post 10-25-2007 10:09 AM by Hong-Gang Chen - MSFT. 7 replies.

Sort Posts:

  • Problem sending email

    10-06-2007, 1:24 PM
    • Loading...
    • danh74
    • Joined on 11-13-2004, 7:50 PM
    • Posts 126

    hi,
    I am  trying to send email but getting this exception:
    Command parameter not implemented. The server response was: : Helo command rejected: need fully-qualified hostname

    The exceptin occur when i call the send() funtion

    Any idea why?

     

     

  • Re: Problem sending email

    10-06-2007, 2:06 PM

    Your code isn't sending your FQDN.  Post your code or see systemnetmail.com.

    Jeff

    Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
  • Re: Problem sending email

    10-06-2007, 2:52 PM
    • Loading...
    • danh74
    • Joined on 11-13-2004, 7:50 PM
    • Posts 126
    Hi
    here is the code

    public static void sendEmail(string fromEmail,string body,bool isHtml)
    {
    MailMessage mail = new MailMessage();
    mail.From =
    new MailAddress(me@test.net);
    mail.To.Add(asp.csharp@gmail.com);
    mail.Subject = "New email form the site " + setting.getConfig("siteUrl");
    mail.Body = body;
    mail.IsBodyHtml = isHtml;
    SmtpClient smtp = new SmtpClient();
    try
    {
    smtp.Send(mail);
    }
    catch (Exception ex)
    {
    HttpContext.Current.Response.Write(ex.Message + "<hr>");
    HttpContext.Current.Response.Write(ex.StackTrace+ "<hr>");
    HttpContext.Current.Response.Write(ex.InnerException + "<hr>");
    }
    }

    what is FQDN?

    TIA

  • Re: Problem sending email

    10-09-2007, 12:19 AM

    danh74:

    Helo command rejected: need fully-qualified hostname

    Hi danh74,

    Base on my experience, you can try the following steps to solve your problem:

    1. Get the properties for your mail server;
    2. Next click the tab;
    3. Network Identification;
    4. Click the properties button;
    5. Under Computer name specify the HOST / Computer (example; mail);
    6. Next click the More button;
    7. Where it says, "Primary DNS suffix of this computer;
    8. Enter your primary domain name(example;youdomain.com);
    9. Click OK and OK again;
    10. Restart your mail server.

    Now you can get the whole mail server name is: mail.youdomain.com.

    Please correct me if I have misunderstood your mean, please LET ME KNOW, Thanks, 

    Hope it helps,

    Hong Gang

    Sincerely,
    Ocean
    Microsoft Online Community Support
    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.
  • Re: Problem sending email

    10-09-2007, 12:32 PM
    • Loading...
    • danh74
    • Joined on 11-13-2004, 7:50 PM
    • Posts 126

    Hi ,

    Thanks for replying,
    I am not sure i understand you.

    I do not have access to the mail server, i only have it's IP

     

     

  • Re: Problem sending email

    10-11-2007, 6:53 AM

    danh74:

    Thanks for replying,
    I am not sure i understand you.I do not have access to the mail server, i only have it's IP

    Do you have any email acount in that IP?

    Waiting for your feedback,

    Hong Gang

    Sincerely,
    Ocean
    Microsoft Online Community Support
    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.
  • Re: Problem sending email

    10-11-2007, 3:59 PM
    • Loading...
    • danh74
    • Joined on 11-13-2004, 7:50 PM
    • Posts 126

    I do not have email account in the IP.
    I am trying to send email to my account in gmail danh74@gmail.com 

    The IP of the email server is "sendmail4.brinkster.com"

    Thanks

     

  • Re: Problem sending email

    10-25-2007, 10:09 AM
    Answer

    danh74:
    I am trying to send email to my account in gmail danh74@gmail.com 
     

    Hi danh74,

    Base on my understating, Gmail has their own SMTP-smtp.gmail.com.

    And you can use the following code snippet to solve your problem:

    //This is fully working tested code. Copy and paste the code
    //Edit some parts(UserName, password) and ENJOY!
    public string sendMail (string from, string to, string cc, string bcc, string subject, string body) {
        // Mail initialization
        MailMessage mailMsg = new MailMessage();
        mailMsg.From = from;
        mailMsg.To = to;
        mailMsg.Cc = cc;
        mailMsg.Bcc = bcc;
        mailMsg.Subject = subject;
        mailMsg.BodyFormat = MailFormat.Text;
        mailMsg.Body = body;
        mailMsg.Priority = MailPriority.High;
        // Smtp configuration
        SmtpMail.SmtpServer = "smtp.gmail.com";
        // - smtp.gmail.com use smtp authentication
        mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
        mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "myemail@gmail.com");
        mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "mypassword");
        // - smtp.gmail.com use port 465 or 587
        mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465");
        // - smtp.gmail.com use STARTTLS (some call this SSL)
        mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true");
        // try to send Mail
        try
        {
            SmtpMail.Send(mailMsg);
            return "";
        }
        catch (Exception ex)
        {
            return ex.Message;
        }
    }

    More information, please visit this link: http://www.codeproject.com/useritems/SendMailUsingGmailAccount.asp

    Hope it helps,

    Hong Gang 

    Sincerely,
    Ocean
    Microsoft Online Community Support
    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.
Page 1 of 1 (8 items)
Microsoft Communities
Page view counter