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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Mail sending problem

Mail sending problem

Scheduled Pinned Locked Moved ASP.NET
csharphelpquestioncomsysadmin
3 Posts 2 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.
  • D Offline
    D Offline
    dipak dipak
    wrote on last edited by
    #1

    Hello Everybody, I have written a code to send mail but it is not working properly. I have added reference of System.Net.Mail; in C# code page and on botton click event I have written following code. try { SmtpClient mySmtpClient = new SmtpClient(); MailMessage myMail = new MailMessage("hr@advantawitty.com", "dipak.dipak@gmail.com", "MyTest Mail", "Hello This is Test Mail using .net Coding"); myMail.IsBodyHtml = true; mySmtpClient.Send(myMail); lblMessage.Text = "Mail Successfully Sent"; } catch (Exception Ex) { lblMessage.Text = Ex.ToString(); } and in web.config file: I am only confusing that what should be Smtp server name for my website.. when I am setting "localhost", it sends a mail which is stored in queue of mailroot on hard drive. But when i am uploading this it is not working.. how can i know my smtp server name? Or is there any other mistake in the code or configuration? Please help me... Thank you. :-O

    Dipak

    S 1 Reply Last reply
    0
    • D dipak dipak

      Hello Everybody, I have written a code to send mail but it is not working properly. I have added reference of System.Net.Mail; in C# code page and on botton click event I have written following code. try { SmtpClient mySmtpClient = new SmtpClient(); MailMessage myMail = new MailMessage("hr@advantawitty.com", "dipak.dipak@gmail.com", "MyTest Mail", "Hello This is Test Mail using .net Coding"); myMail.IsBodyHtml = true; mySmtpClient.Send(myMail); lblMessage.Text = "Mail Successfully Sent"; } catch (Exception Ex) { lblMessage.Text = Ex.ToString(); } and in web.config file: I am only confusing that what should be Smtp server name for my website.. when I am setting "localhost", it sends a mail which is stored in queue of mailroot on hard drive. But when i am uploading this it is not working.. how can i know my smtp server name? Or is there any other mistake in the code or configuration? Please help me... Thank you. :-O

      Dipak

      S Offline
      S Offline
      Shyam Bharath
      wrote on last edited by
      #2

      If SMTP is enabled in your web server, shouldn't it be something like "smtp.advantawitty.com"? Ask your service provider, he would be knowing the correct address and SMTP port number.

      ------------------------------------------- It's code that drives you - Shyam

      D 1 Reply Last reply
      0
      • S Shyam Bharath

        If SMTP is enabled in your web server, shouldn't it be something like "smtp.advantawitty.com"? Ask your service provider, he would be knowing the correct address and SMTP port number.

        ------------------------------------------- It's code that drives you - Shyam

        D Offline
        D Offline
        dipak dipak
        wrote on last edited by
        #3

        Thank you for reply. I have asked to Provider and got the details And it is finely working. my code was correct but only I have added mySmtpClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis; and it is running properly. Thank you.

        Dipak

        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