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 from asp.net (C# coding)

Sending mail from asp.net (C# coding)

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netcomsysadmin
7 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.
  • H Offline
    H Offline
    Hema Bairavan
    wrote on last edited by
    #1

    hi i am doing an application from which i have to send a mail to the peoples of which i can get the mail ID from the text box. this is the code i have written. using System.Net.Mail; using System.Web.Mail; System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage(); mail.To = emailID.Text.ToString().Trim(); mail.Subject = "Focus Consultancy Online Test-User ID & Pasword"; mail.BodyFormat = MailFormat.Text; mail.Body = "this is the test mail"; SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mail); this is the error i got, The server rejected one or more recipient addresses. T he server response was: 550 5.7.1 Unable to relay for xxx@xxx.com Please help me in solving this

    A M J 3 Replies Last reply
    0
    • H Hema Bairavan

      hi i am doing an application from which i have to send a mail to the peoples of which i can get the mail ID from the text box. this is the code i have written. using System.Net.Mail; using System.Web.Mail; System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage(); mail.To = emailID.Text.ToString().Trim(); mail.Subject = "Focus Consultancy Online Test-User ID & Pasword"; mail.BodyFormat = MailFormat.Text; mail.Body = "this is the test mail"; SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mail); this is the error i got, The server rejected one or more recipient addresses. T he server response was: 550 5.7.1 Unable to relay for xxx@xxx.com Please help me in solving this

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

      Hema Bairavan wrote:

      SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mail);

      Did you configure SMTP server Properly ?

      cheers, Abhijit CodeProject MVP My Recent Article : Exploring Session in ASP.Net

      H 1 Reply Last reply
      0
      • H Hema Bairavan

        hi i am doing an application from which i have to send a mail to the peoples of which i can get the mail ID from the text box. this is the code i have written. using System.Net.Mail; using System.Web.Mail; System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage(); mail.To = emailID.Text.ToString().Trim(); mail.Subject = "Focus Consultancy Online Test-User ID & Pasword"; mail.BodyFormat = MailFormat.Text; mail.Body = "this is the test mail"; SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mail); this is the error i got, The server rejected one or more recipient addresses. T he server response was: 550 5.7.1 Unable to relay for xxx@xxx.com Please help me in solving this

        M Offline
        M Offline
        Manas Bhardwaj
        wrote on last edited by
        #3

        Make sure all email addresses specified at MailMessage.To, MailMessage.Cc, MailMessage.Bcc and MailMessage.From are valid email addresses. Make sure you have permissions to relay through the server. Make sure the MailMessage.From has permissions to relay through the server.

        Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        H 1 Reply Last reply
        0
        • A Abhijit Jana

          Hema Bairavan wrote:

          SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mail);

          Did you configure SMTP server Properly ?

          cheers, Abhijit CodeProject MVP My Recent Article : Exploring Session in ASP.Net

          H Offline
          H Offline
          Hema Bairavan
          wrote on last edited by
          #4

          Thanks for your reply mr Abhijith. i searched in net how to configure the SMTP server, but i dont get any good resources. can you please help me?

          A 1 Reply Last reply
          0
          • M Manas Bhardwaj

            Make sure all email addresses specified at MailMessage.To, MailMessage.Cc, MailMessage.Bcc and MailMessage.From are valid email addresses. Make sure you have permissions to relay through the server. Make sure the MailMessage.From has permissions to relay through the server.

            Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

            H Offline
            H Offline
            Hema Bairavan
            wrote on last edited by
            #5

            mr Bharadwaj, actually i am new for using the smtp servers, can you please explain in detail about the giving permissions and all if you dont mind ?

            1 Reply Last reply
            0
            • H Hema Bairavan

              Thanks for your reply mr Abhijith. i searched in net how to configure the SMTP server, but i dont get any good resources. can you please help me?

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

              SMTP Server Setup (IIS 6.0)[^]

              cheers, Abhijit CodeProject MVP My Recent Article : Exploring Session in ASP.Net

              1 Reply Last reply
              0
              • H Hema Bairavan

                hi i am doing an application from which i have to send a mail to the peoples of which i can get the mail ID from the text box. this is the code i have written. using System.Net.Mail; using System.Web.Mail; System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage(); mail.To = emailID.Text.ToString().Trim(); mail.Subject = "Focus Consultancy Online Test-User ID & Pasword"; mail.BodyFormat = MailFormat.Text; mail.Body = "this is the test mail"; SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mail); this is the error i got, The server rejected one or more recipient addresses. T he server response was: 550 5.7.1 Unable to relay for xxx@xxx.com Please help me in solving this

                J Offline
                J Offline
                josh417
                wrote on last edited by
                #7

                Hey hi bhiravan, I hope the line SmtpMail.SmtpServer = "localhost" line creates the main problem. As ur specifying the server name as local host it doesnot allow all the other domain email addresses except your domain.So you need change the server name as "127.1.1.0" which is a global server address and even you need to change the smtp virtual server settings in IIS. Goto start->run->inetmgr where u will get ur IIS settings.right click on the Default smtp server and goto properties,go to Access tab,click on connection tab,then click on Add tab.There you need to enter ip address as 127.1.1.0 then click on ok. Then try it out.I hope now it works. If not let me know.Good luck. :)

                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