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 Email

sending Email

Scheduled Pinned Locked Moved ASP.NET
helpcsharpcomdata-structuresquestion
6 Posts 4 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.
  • J Offline
    J Offline
    joindotnet
    wrote on last edited by
    #1

    hi all, I am learning to send an email frm my website using system.net.mail. The mail is sent and there is no error but the recipient doesn't recieve the mail but it is shown in Inetpub\mailroot\queue and after sometime delivery is failed. Plz help me.Where I am wrong ?? Any specific setting for this?? //variables string strFromEmail = tbxFrom.Text; string strToEmail = tbxTo.Text; string strSubject = tbxSubject.Text; string strMsg = ftbMsg.Text; string strHostName = "mail.gmail.com"; int iHostSMTPPort=25; //string strImagePath; //variable to create message instace MailAddress mailAddrFrom = new MailAddress(strFromEmail); MailAddress mailAddrTo = new MailAddress(strToEmail); MailMessage msgObj = new MailMessage(mailAddrFrom,mailAddrTo); //definitions to send mail SmtpClient smtpObj = new SmtpClient(strHostName, iHostSMTPPort); //settings to send email msgObj.Subject = strSubject; msgObj.Body = strMsg; msgObj.IsBodyHtml = true; smtpObj.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis; //sending email smtpObj.Send(msgObj);

    A N 2 Replies Last reply
    0
    • J joindotnet

      hi all, I am learning to send an email frm my website using system.net.mail. The mail is sent and there is no error but the recipient doesn't recieve the mail but it is shown in Inetpub\mailroot\queue and after sometime delivery is failed. Plz help me.Where I am wrong ?? Any specific setting for this?? //variables string strFromEmail = tbxFrom.Text; string strToEmail = tbxTo.Text; string strSubject = tbxSubject.Text; string strMsg = ftbMsg.Text; string strHostName = "mail.gmail.com"; int iHostSMTPPort=25; //string strImagePath; //variable to create message instace MailAddress mailAddrFrom = new MailAddress(strFromEmail); MailAddress mailAddrTo = new MailAddress(strToEmail); MailMessage msgObj = new MailMessage(mailAddrFrom,mailAddrTo); //definitions to send mail SmtpClient smtpObj = new SmtpClient(strHostName, iHostSMTPPort); //settings to send email msgObj.Subject = strSubject; msgObj.Body = strMsg; msgObj.IsBodyHtml = true; smtpObj.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis; //sending email smtpObj.Send(msgObj);

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

      Does your SMTP server Configure properly?

      cheers, Abhijit Read My Latest Article

      J 1 Reply Last reply
      0
      • A Abhijit Jana

        Does your SMTP server Configure properly?

        cheers, Abhijit Read My Latest Article

        J Offline
        J Offline
        joindotnet
        wrote on last edited by
        #3

        I don't know. It works fine when I send email from my gmail account.but fails when I use any other domaim.I use server smtp.gmail.com Thanks for ur response.

        T 1 Reply Last reply
        0
        • J joindotnet

          hi all, I am learning to send an email frm my website using system.net.mail. The mail is sent and there is no error but the recipient doesn't recieve the mail but it is shown in Inetpub\mailroot\queue and after sometime delivery is failed. Plz help me.Where I am wrong ?? Any specific setting for this?? //variables string strFromEmail = tbxFrom.Text; string strToEmail = tbxTo.Text; string strSubject = tbxSubject.Text; string strMsg = ftbMsg.Text; string strHostName = "mail.gmail.com"; int iHostSMTPPort=25; //string strImagePath; //variable to create message instace MailAddress mailAddrFrom = new MailAddress(strFromEmail); MailAddress mailAddrTo = new MailAddress(strToEmail); MailMessage msgObj = new MailMessage(mailAddrFrom,mailAddrTo); //definitions to send mail SmtpClient smtpObj = new SmtpClient(strHostName, iHostSMTPPort); //settings to send email msgObj.Subject = strSubject; msgObj.Body = strMsg; msgObj.IsBodyHtml = true; smtpObj.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis; //sending email smtpObj.Send(msgObj);

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          joindotnet wrote:

          Inetpub\mailroot\queue

          Your SMTP server might be stopped. Type inetmgr in the "Run" window, Click on "Default SMTP server" and start it.

          Navaneeth How to use google | Ask smart questions

          J 1 Reply Last reply
          0
          • N N a v a n e e t h

            joindotnet wrote:

            Inetpub\mailroot\queue

            Your SMTP server might be stopped. Type inetmgr in the "Run" window, Click on "Default SMTP server" and start it.

            Navaneeth How to use google | Ask smart questions

            J Offline
            J Offline
            joindotnet
            wrote on last edited by
            #5

            It is not stopped.I have checked it.I can send emails from gmail to gmail if I use smtp.gmail.com host server. How can I send mail from any domain to any domain. Plz help.I'd be obliged.

            1 Reply Last reply
            0
            • J joindotnet

              I don't know. It works fine when I send email from my gmail account.but fails when I use any other domaim.I use server smtp.gmail.com Thanks for ur response.

              T Offline
              T Offline
              Tarun Dudhatra
              wrote on last edited by
              #6

              You can not use smtp.gmail.com you have to use mail.yourdomainname.com. and if you are sending from local system then use localhost or 127.0.0.1 I hope it will help you. http://techiefromsurat.blogspot.com

              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