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. General Programming
  3. C#
  4. Steps to send an email from ASP.NET application

Steps to send an email from ASP.NET application

Scheduled Pinned Locked Moved C#
csharpasp-nethelp
5 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.
  • K Offline
    K Offline
    KKrista
    wrote on last edited by
    #1

    Hi All, I have developed an ASP.NET application to send emails. I have followed the coding steps to create the application. But however, the mail is not getting delivered to the destination ID. Can anyone help me in giving details about all the steps to be done before running the application. A sample application would be more helpful. Thanks in advance, Murali

    S 1 Reply Last reply
    0
    • K KKrista

      Hi All, I have developed an ASP.NET application to send emails. I have followed the coding steps to create the application. But however, the mail is not getting delivered to the destination ID. Can anyone help me in giving details about all the steps to be done before running the application. A sample application would be more helpful. Thanks in advance, Murali

      S Offline
      S Offline
      Sathesh Sakthivel
      wrote on last edited by
      #2

      What you have coded for the SMTP? And what error it shows? Did the Norton blocking you in sending the mails?

      Regards, Satips.

      K 1 Reply Last reply
      0
      • S Sathesh Sakthivel

        What you have coded for the SMTP? And what error it shows? Did the Norton blocking you in sending the mails?

        Regards, Satips.

        K Offline
        K Offline
        KKrista
        wrote on last edited by
        #3

        Hi, Thanks for the reply. If i set the SMTP Server name in the code as "smtp.gmail.com"(example), then i get the 'Could not access(CDO.Message) object' error message. However, if i set it as 'localhost' then the email is redirected to the 'Queue' folder under the /Inetpub/mailroot. Do i need to do any more settings? Thanks in advance, Murali

        S 1 Reply Last reply
        0
        • K KKrista

          Hi, Thanks for the reply. If i set the SMTP Server name in the code as "smtp.gmail.com"(example), then i get the 'Could not access(CDO.Message) object' error message. However, if i set it as 'localhost' then the email is redirected to the 'Queue' folder under the /Inetpub/mailroot. Do i need to do any more settings? Thanks in advance, Murali

          S Offline
          S Offline
          Sathesh Sakthivel
          wrote on last edited by
          #4

          (1)Specify a valid mail server for the SmtpMail.SmtpServer property. If that property is not set, at least set it to 127.0.0.1. For example: SmtpMail.SmtpServer = "127.0.0.1" (2)If you are using "localhost" or "127.0.0.1" as the SmtpMail.SmtpServer, you may not have permissions to relay through the IIS SMTP Service. To allow access, open up the IIS Admin MMC. Locate the SMTP Virtual Server, and right-click, then select Properties. On the Access tab, click the Relay button. In the Relay Restrictions dialog, grant your IP address (127.0.0.1) to the Computers listbox. Close down all dialogs, and restart the SMTP Service. (3)If you are using "localhost" or "127.0.0.1" as the SmtpMail.SmtpServer, make sure Anonymous access is allowd. To allow access, open up the IIS Admin MMC. Locate the SMTP Virtual Server, and right-click, then select Properties. On the Access tab, click the Authentication button. Be sure "Anonymous Access" is the only checkbox checked. Close down all dialogs, and restart the SMTP Service. (4)The email address does not have a valid TO address. After iterating through the InnerExceptions, you may find this error message actually has to do with relaying. Try sending a test email to an email address that exists on the server specified by SmtpMail.SmtpServer. If you can send an email to that server, then it is a relay issue. Talk to your mail server administrator about letting your code relay through the mail server. (5)Use a real FROM address that exists on the SmtpMail.SmtpServer. Do not use something like "asdf@asdf.com", or some other bogus address as your MailMessage.FromProperty. More advanced mail servers will catch this, and will deny relaying.

          Regards, Satips.

          K 1 Reply Last reply
          0
          • S Sathesh Sakthivel

            (1)Specify a valid mail server for the SmtpMail.SmtpServer property. If that property is not set, at least set it to 127.0.0.1. For example: SmtpMail.SmtpServer = "127.0.0.1" (2)If you are using "localhost" or "127.0.0.1" as the SmtpMail.SmtpServer, you may not have permissions to relay through the IIS SMTP Service. To allow access, open up the IIS Admin MMC. Locate the SMTP Virtual Server, and right-click, then select Properties. On the Access tab, click the Relay button. In the Relay Restrictions dialog, grant your IP address (127.0.0.1) to the Computers listbox. Close down all dialogs, and restart the SMTP Service. (3)If you are using "localhost" or "127.0.0.1" as the SmtpMail.SmtpServer, make sure Anonymous access is allowd. To allow access, open up the IIS Admin MMC. Locate the SMTP Virtual Server, and right-click, then select Properties. On the Access tab, click the Authentication button. Be sure "Anonymous Access" is the only checkbox checked. Close down all dialogs, and restart the SMTP Service. (4)The email address does not have a valid TO address. After iterating through the InnerExceptions, you may find this error message actually has to do with relaying. Try sending a test email to an email address that exists on the server specified by SmtpMail.SmtpServer. If you can send an email to that server, then it is a relay issue. Talk to your mail server administrator about letting your code relay through the mail server. (5)Use a real FROM address that exists on the SmtpMail.SmtpServer. Do not use something like "asdf@asdf.com", or some other bogus address as your MailMessage.FromProperty. More advanced mail servers will catch this, and will deny relaying.

            Regards, Satips.

            K Offline
            K Offline
            KKrista
            wrote on last edited by
            #5

            Hi, I followed your steps. I send a sample mail to an ID existing in the local SMTP Server and the delivery was a SUCCESS. However, if i try to send the mail to a different ID say hello@gmail.com, then i get a delivery fail message in the 'Drop' folder of the 'mailroot' folder. Do i need to enable some options in the destination SMTP Server to recieve mails from my machine?

            Thanks in advance, Murali

            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