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. How can i send email from my webform

How can i send email from my webform

Scheduled Pinned Locked Moved ASP.NET
questionhelpcom
10 Posts 6 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.
  • A Offline
    A Offline
    anujose
    wrote on last edited by
    #1

    my code is like this MailMessage mail=new MailMessage(); mail.To ="anu@gmail.com"; mail.From ="anu2@gmail.com"; mail.Subject = "Hai"; mail.Body = "your subject"; SmtpMail.Send(mail); it's executing.but i am not getting msg in my mail?what is the problem? When i am using this code Smtpmail.send(="anu@gmail.com","anu2@gmail.com","Hai","your subject") i am getting mail in anu2 can anyone tell what is the problem in above code? is there any thing i haveto set in webconfig file?Then How?....... Can anyone please help me?..it's urgent

    S S S V 4 Replies Last reply
    0
    • A anujose

      my code is like this MailMessage mail=new MailMessage(); mail.To ="anu@gmail.com"; mail.From ="anu2@gmail.com"; mail.Subject = "Hai"; mail.Body = "your subject"; SmtpMail.Send(mail); it's executing.but i am not getting msg in my mail?what is the problem? When i am using this code Smtpmail.send(="anu@gmail.com","anu2@gmail.com","Hai","your subject") i am getting mail in anu2 can anyone tell what is the problem in above code? is there any thing i haveto set in webconfig file?Then How?....... Can anyone please help me?..it's urgent

      S Offline
      S Offline
      Sylvester george
      wrote on last edited by
      #2

      Hi this is the method with arguments for send ============================================= public static void Send ( System.String from , System.String to , System.String subject , System.String messageText ) Member of System.Web.Mail.SmtpMail Summary: Sends an e-mail message using the specified destination parameters. Parameters: from: The address of the e-mail sender. to: The address of the e-mail recipient. subject: The subject line of the e-mail message. messageText: The body of the e-mail message. So its correct its sendting to anu2

      Regards, Sylvester G sylvester_g_m@yahoo.com

      A 1 Reply Last reply
      0
      • S Sylvester george

        Hi this is the method with arguments for send ============================================= public static void Send ( System.String from , System.String to , System.String subject , System.String messageText ) Member of System.Web.Mail.SmtpMail Summary: Sends an e-mail message using the specified destination parameters. Parameters: from: The address of the e-mail sender. to: The address of the e-mail recipient. subject: The subject line of the e-mail message. messageText: The body of the e-mail message. So its correct its sendting to anu2

        Regards, Sylvester G sylvester_g_m@yahoo.com

        A Offline
        A Offline
        anujose
        wrote on last edited by
        #3

        Actually i want to send mail by using mailmessage object.....

        1 Reply Last reply
        0
        • A anujose

          my code is like this MailMessage mail=new MailMessage(); mail.To ="anu@gmail.com"; mail.From ="anu2@gmail.com"; mail.Subject = "Hai"; mail.Body = "your subject"; SmtpMail.Send(mail); it's executing.but i am not getting msg in my mail?what is the problem? When i am using this code Smtpmail.send(="anu@gmail.com","anu2@gmail.com","Hai","your subject") i am getting mail in anu2 can anyone tell what is the problem in above code? is there any thing i haveto set in webconfig file?Then How?....... Can anyone please help me?..it's urgent

          S Offline
          S Offline
          Spunky Coder
          wrote on last edited by
          #4

          Try This One it should work... System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage(); mm.Subject = "Test Mail"; mm.Body = "This is a Test mail"; mm.IsBodyHtml = true; System.Net.Mail.SmtpClient ss = new System.Net.Mail.SmtpClient(); System.Net.Mail.MailAddress ma = new System.Net.Mail.MailAddress("test@test.com"); mm.To.Add(ma); ss.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.PickupDirectoryFromIis; ss.Host = "setyouripaddress her"; ss.Send(mm);

          Koushik

          1 Reply Last reply
          0
          • A anujose

            my code is like this MailMessage mail=new MailMessage(); mail.To ="anu@gmail.com"; mail.From ="anu2@gmail.com"; mail.Subject = "Hai"; mail.Body = "your subject"; SmtpMail.Send(mail); it's executing.but i am not getting msg in my mail?what is the problem? When i am using this code Smtpmail.send(="anu@gmail.com","anu2@gmail.com","Hai","your subject") i am getting mail in anu2 can anyone tell what is the problem in above code? is there any thing i haveto set in webconfig file?Then How?....... Can anyone please help me?..it's urgent

            S Offline
            S Offline
            shah zad
            wrote on last edited by
            #5

            i think your smtp have a prob try this its a working code hope your problem will solved and try to use "try/catch" in your code an then read the exception if code dont work that will explain you whats the problem..... try { MailMessage objMail; objMail = new MailMessage(); objMail.From = "Sender address"; objMail.To = "Recipient address"; objMail.Subject = "Subject of your mail"; objMail.BodyFormat = MailFormat.Html;//you can use text for text message objMail.Priority = MailPriority.High; objMail.Body = "Body of your mail"; SmtpMail.SmtpServer = "Your smtp server name"; SmtpMail.Send(objMail); objMail = null; } catch(Exception ex) { Response.Write(ex);//this will tell you the problem if got }

            shezi

            A 1 Reply Last reply
            0
            • S shah zad

              i think your smtp have a prob try this its a working code hope your problem will solved and try to use "try/catch" in your code an then read the exception if code dont work that will explain you whats the problem..... try { MailMessage objMail; objMail = new MailMessage(); objMail.From = "Sender address"; objMail.To = "Recipient address"; objMail.Subject = "Subject of your mail"; objMail.BodyFormat = MailFormat.Html;//you can use text for text message objMail.Priority = MailPriority.High; objMail.Body = "Body of your mail"; SmtpMail.SmtpServer = "Your smtp server name"; SmtpMail.Send(objMail); objMail = null; } catch(Exception ex) { Response.Write(ex);//this will tell you the problem if got }

              shezi

              A Offline
              A Offline
              anujose
              wrote on last edited by
              #6

              i am getting a error like this Could not access 'CDO.Message' object

              S 1 Reply Last reply
              0
              • A anujose

                i am getting a error like this Could not access 'CDO.Message' object

                S Offline
                S Offline
                Sylvester george
                wrote on last edited by
                #7

                Which OS you are using ?

                Regards, Sylvester G sylvester_g_m@yahoo.com

                A 1 Reply Last reply
                0
                • S Sylvester george

                  Which OS you are using ?

                  Regards, Sylvester G sylvester_g_m@yahoo.com

                  A Offline
                  A Offline
                  anujose
                  wrote on last edited by
                  #8

                  Windows Xp

                  H 1 Reply Last reply
                  0
                  • A anujose

                    Windows Xp

                    H Offline
                    H Offline
                    Haissam
                    wrote on last edited by
                    #9

                    Check the below link All about emails asp.net

                    Best Regards, Haissam Abdul Malak My Blog

                    1 Reply Last reply
                    0
                    • A anujose

                      my code is like this MailMessage mail=new MailMessage(); mail.To ="anu@gmail.com"; mail.From ="anu2@gmail.com"; mail.Subject = "Hai"; mail.Body = "your subject"; SmtpMail.Send(mail); it's executing.but i am not getting msg in my mail?what is the problem? When i am using this code Smtpmail.send(="anu@gmail.com","anu2@gmail.com","Hai","your subject") i am getting mail in anu2 can anyone tell what is the problem in above code? is there any thing i haveto set in webconfig file?Then How?....... Can anyone please help me?..it's urgent

                      V Offline
                      V Offline
                      Vasudevan Deepak Kumar
                      wrote on last edited by
                      #10

                      http://lavanyadeepak.blogspot.com/2007/03/comprehensive-email-troubleshooting.html[^]

                      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                      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