Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Sending mail....problem

Sending mail....problem

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netdotnetcom
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RajpootRohan
    wrote on last edited by
    #1

    Hi to all, I am trying to send the "contact us" from data to email on submit button click. But giving this error.

    Server Error in '/VICTORIAIN' Application.
    Mailbox unavailable. The server response was: not local host hotmail.com, not a gateway
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: not local host hotmail.com, not a gateway

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [SmtpFailedRecipientException: Mailbox unavailable. The server response was: not local host hotmail.com, not a gateway]
    System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) +858231
    System.Net.Mail.SmtpClient.Send(MailMessage message) +2004
    Contact_Us.send_data_to_mail() +189
    Contact_Us.BtnSubmit_Click(Object sender, EventArgs e) +18
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

    I am using this code:

        SmtpClient smtpClient = new SmtpClient();
        MailMessage message = new MailMessage();
    
        MailAddress fromAddress = new MailAddress(TxtEmail.Text, TxtName.Text);
        message.From = fromAddress;
        message.To.Add("rohanrajpoot@in.com");
        message.Subject = "This person has contacted us!";
        message.IsBodyHtml = false;
        message.Body = TxtMessage.Text;
        smtpClient.Send(message);
    

    In web.config I did this:

    <system.net>
    <mailS

    A G 2 Replies Last reply
    0
    • R RajpootRohan

      Hi to all, I am trying to send the "contact us" from data to email on submit button click. But giving this error.

      Server Error in '/VICTORIAIN' Application.
      Mailbox unavailable. The server response was: not local host hotmail.com, not a gateway
      Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

      Exception Details: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: not local host hotmail.com, not a gateway

      Source Error:

      An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

      Stack Trace:

      [SmtpFailedRecipientException: Mailbox unavailable. The server response was: not local host hotmail.com, not a gateway]
      System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) +858231
      System.Net.Mail.SmtpClient.Send(MailMessage message) +2004
      Contact_Us.send_data_to_mail() +189
      Contact_Us.BtnSubmit_Click(Object sender, EventArgs e) +18
      System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
      System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
      System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
      System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
      System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
      System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

      Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

      I am using this code:

          SmtpClient smtpClient = new SmtpClient();
          MailMessage message = new MailMessage();
      
          MailAddress fromAddress = new MailAddress(TxtEmail.Text, TxtName.Text);
          message.From = fromAddress;
          message.To.Add("rohanrajpoot@in.com");
          message.Subject = "This person has contacted us!";
          message.IsBodyHtml = false;
          message.Body = TxtMessage.Text;
          smtpClient.Send(message);
      

      In web.config I did this:

      <system.net>
      <mailS

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      sneha Choudhary wrote:

      Does SMTP configure Properly ?

      cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net My Latest Article : IIS Remote Debugging

      1 Reply Last reply
      0
      • R RajpootRohan

        Hi to all, I am trying to send the "contact us" from data to email on submit button click. But giving this error.

        Server Error in '/VICTORIAIN' Application.
        Mailbox unavailable. The server response was: not local host hotmail.com, not a gateway
        Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

        Exception Details: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: not local host hotmail.com, not a gateway

        Source Error:

        An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

        Stack Trace:

        [SmtpFailedRecipientException: Mailbox unavailable. The server response was: not local host hotmail.com, not a gateway]
        System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) +858231
        System.Net.Mail.SmtpClient.Send(MailMessage message) +2004
        Contact_Us.send_data_to_mail() +189
        Contact_Us.BtnSubmit_Click(Object sender, EventArgs e) +18
        System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
        System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
        System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
        System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
        System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
        System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

        Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

        I am using this code:

            SmtpClient smtpClient = new SmtpClient();
            MailMessage message = new MailMessage();
        
            MailAddress fromAddress = new MailAddress(TxtEmail.Text, TxtName.Text);
            message.From = fromAddress;
            message.To.Add("rohanrajpoot@in.com");
            message.Subject = "This person has contacted us!";
            message.IsBodyHtml = false;
            message.Body = TxtMessage.Text;
            smtpClient.Send(message);
        

        In web.config I did this:

        <system.net>
        <mailS

        G Offline
        G Offline
        Gary Stafford
        wrote on last edited by
        #3

        I agree with the previous comment, it seems like your SMTP mail server must be configured incorrectly in your web.config file. I tested your code (slightly modified), using localhost as the mail server; it worked just fine.

        //Test Strings
        string TxtEmail = "Sue.Smith@123.com";
        string TxtName = "Sue Smith";
        string TxtMessage = "This is a test email message.";

        using(MailMessage message = new MailMessage())
        {
        message.From = new MailAddress(TxtEmail, TxtName);
        message.To.Add(new MailAddress("rohanrajpoot@in.com"));
        message.Subject = "This person has contacted us!";
        message.IsBodyHtml = false;
        message.Body = TxtMessage;
        SmtpClient smtpClient = new SmtpClient { Host = "localhost" };
        smtpClient.Send(message);
        }

        Regards, Gary

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups