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. problem in sending SMTP mail

problem in sending SMTP mail

Scheduled Pinned Locked Moved C#
csharphelpvisual-studiocomsysadmin
9 Posts 5 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.
  • V Offline
    V Offline
    varun_mca_ju 0
    wrote on last edited by
    #1

    i am using Visual Studio 2005 and i'm using the following code to send mail:- try { MailMessage mail = new MailMessage(); mail.To = varunmcaju@gmail.com; mail.From = varun_mcaju@rediffmail.com; mail.Body = "Sending mail through .NET SMTP mail"; SmtpMail.SmtpServer = "127.0.0.1"; SmtpMail.Send(mail); MessageBox.Show("Mail sent successfully"); } catch (Exception ex) { MessageBox.Show(ex.Message); } when i run this code it gives no error ...but the mail is never delivered. Then i checked the C:\Inetpub\mailroot\Queue folder and found the following message "This is an automatically generated Delivery Status Notification. Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server. varunmcaju@gmail.com " why is it unable to connect to the destination server :~...any ideas? thanks in advance

    S M G L 4 Replies Last reply
    0
    • V varun_mca_ju 0

      i am using Visual Studio 2005 and i'm using the following code to send mail:- try { MailMessage mail = new MailMessage(); mail.To = varunmcaju@gmail.com; mail.From = varun_mcaju@rediffmail.com; mail.Body = "Sending mail through .NET SMTP mail"; SmtpMail.SmtpServer = "127.0.0.1"; SmtpMail.Send(mail); MessageBox.Show("Mail sent successfully"); } catch (Exception ex) { MessageBox.Show(ex.Message); } when i run this code it gives no error ...but the mail is never delivered. Then i checked the C:\Inetpub\mailroot\Queue folder and found the following message "This is an automatically generated Delivery Status Notification. Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server. varunmcaju@gmail.com " why is it unable to connect to the destination server :~...any ideas? thanks in advance

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

      MailMessage objEmail = new MailMessage(); objEmail.To = txtTo.Text; objEmail.From = txtFrom.Text; objEmail.Cc = txtCc.Text; objEmail.Subject = "Test Email"; objEmail.Body = txtName.Text + ", " + txtComments.Text; objEmail.Priority = MailPriority.High; //SmtpMail.SmtpServer = "localhost"; try{ SmtpMail.Send(objEmail); Response.Write("Your Email has been sent sucessfully - Thank You"); } catch (Exception exc){ Response.Write("Send failure: " + exc.ToString()); }

      SSK. Anyone who says sunshine brings happiness has never danced in the rain.

      V M 2 Replies Last reply
      0
      • S Sathesh Sakthivel

        MailMessage objEmail = new MailMessage(); objEmail.To = txtTo.Text; objEmail.From = txtFrom.Text; objEmail.Cc = txtCc.Text; objEmail.Subject = "Test Email"; objEmail.Body = txtName.Text + ", " + txtComments.Text; objEmail.Priority = MailPriority.High; //SmtpMail.SmtpServer = "localhost"; try{ SmtpMail.Send(objEmail); Response.Write("Your Email has been sent sucessfully - Thank You"); } catch (Exception exc){ Response.Write("Send failure: " + exc.ToString()); }

        SSK. Anyone who says sunshine brings happiness has never danced in the rain.

        V Offline
        V Offline
        varun_mca_ju 0
        wrote on last edited by
        #3

        thanks for the reply SSK :) , but there's not much of a difference between my code and your code .What i wanted to know was that why is the mail not being sent?

        1 Reply Last reply
        0
        • S Sathesh Sakthivel

          MailMessage objEmail = new MailMessage(); objEmail.To = txtTo.Text; objEmail.From = txtFrom.Text; objEmail.Cc = txtCc.Text; objEmail.Subject = "Test Email"; objEmail.Body = txtName.Text + ", " + txtComments.Text; objEmail.Priority = MailPriority.High; //SmtpMail.SmtpServer = "localhost"; try{ SmtpMail.Send(objEmail); Response.Write("Your Email has been sent sucessfully - Thank You"); } catch (Exception exc){ Response.Write("Send failure: " + exc.ToString()); }

          SSK. Anyone who says sunshine brings happiness has never danced in the rain.

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

          What was your point of sending the code. I see no difference between the two except that his is for Windows and yours in Web. :omg:

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

          1 Reply Last reply
          0
          • V varun_mca_ju 0

            i am using Visual Studio 2005 and i'm using the following code to send mail:- try { MailMessage mail = new MailMessage(); mail.To = varunmcaju@gmail.com; mail.From = varun_mcaju@rediffmail.com; mail.Body = "Sending mail through .NET SMTP mail"; SmtpMail.SmtpServer = "127.0.0.1"; SmtpMail.Send(mail); MessageBox.Show("Mail sent successfully"); } catch (Exception ex) { MessageBox.Show(ex.Message); } when i run this code it gives no error ...but the mail is never delivered. Then i checked the C:\Inetpub\mailroot\Queue folder and found the following message "This is an automatically generated Delivery Status Notification. Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server. varunmcaju@gmail.com " why is it unable to connect to the destination server :~...any ideas? thanks in advance

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

            varun_mca_ju wrote:

            Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server.

            Code is perfect and I do not see any changes desired. Seems like your SMTP Server is not properly configured.

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

            V 1 Reply Last reply
            0
            • M Manas Bhardwaj

              varun_mca_ju wrote:

              Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server.

              Code is perfect and I do not see any changes desired. Seems like your SMTP Server is not properly configured.

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

              V Offline
              V Offline
              varun_mca_ju 0
              wrote on last edited by
              #6

              thanks for the reply Manas..my SMTP settings are as follows : General-> IP Address -> [All Unassigned] Access->Relay->Relay Restrictions->Only the list below->access granted to 127.0.0.1 and also to the IP address of my computer, also the SMTP server is running....do i have to make any changes to the configuration?

              M 1 Reply Last reply
              0
              • V varun_mca_ju 0

                thanks for the reply Manas..my SMTP settings are as follows : General-> IP Address -> [All Unassigned] Access->Relay->Relay Restrictions->Only the list below->access granted to 127.0.0.1 and also to the IP address of my computer, also the SMTP server is running....do i have to make any changes to the configuration?

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

                It sounds like your mail server is not registered in DNS and servers outside your domain cannot do a reverse DNS lookup on it. This is a common method of preventing spam from spoofed mail server addresses. Register the name in DNS (MX record) with your ISP and the problem should go away.

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

                1 Reply Last reply
                0
                • V varun_mca_ju 0

                  i am using Visual Studio 2005 and i'm using the following code to send mail:- try { MailMessage mail = new MailMessage(); mail.To = varunmcaju@gmail.com; mail.From = varun_mcaju@rediffmail.com; mail.Body = "Sending mail through .NET SMTP mail"; SmtpMail.SmtpServer = "127.0.0.1"; SmtpMail.Send(mail); MessageBox.Show("Mail sent successfully"); } catch (Exception ex) { MessageBox.Show(ex.Message); } when i run this code it gives no error ...but the mail is never delivered. Then i checked the C:\Inetpub\mailroot\Queue folder and found the following message "This is an automatically generated Delivery Status Notification. Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server. varunmcaju@gmail.com " why is it unable to connect to the destination server :~...any ideas? thanks in advance

                  G Offline
                  G Offline
                  Guffa
                  wrote on last edited by
                  #8

                  Does your ISP allow sending mail using your own SMTP server? It's not uncommon that the port is blocked to prevent spam, in that case you have to use the SMTP server that the ISP provides instead.

                  Despite everything, the person most likely to be fooling you next is yourself.

                  1 Reply Last reply
                  0
                  • V varun_mca_ju 0

                    i am using Visual Studio 2005 and i'm using the following code to send mail:- try { MailMessage mail = new MailMessage(); mail.To = varunmcaju@gmail.com; mail.From = varun_mcaju@rediffmail.com; mail.Body = "Sending mail through .NET SMTP mail"; SmtpMail.SmtpServer = "127.0.0.1"; SmtpMail.Send(mail); MessageBox.Show("Mail sent successfully"); } catch (Exception ex) { MessageBox.Show(ex.Message); } when i run this code it gives no error ...but the mail is never delivered. Then i checked the C:\Inetpub\mailroot\Queue folder and found the following message "This is an automatically generated Delivery Status Notification. Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server. varunmcaju@gmail.com " why is it unable to connect to the destination server :~...any ideas? thanks in advance

                    L Offline
                    L Offline
                    Learning IT
                    wrote on last edited by
                    #9

                    same problem has occured with me but the next day i have found that mail is sent.wait for a while..... ;)

                    Maniiiiiiiiiiiiiii

                    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