Sending Email (Using ASP.Net with C# Language)
-
I wrote an article on how to use google, it's here on Code Project. You should read it. Sending an email is both so trivial, and so widely documented, that I used it as the example in showing how to find basic information on the internet. ASP.NET also cannot send email, your website will use .NET code that does not depend on ASP.NET
Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
-
-
misCafe wrote:
i'm looking for code (asp.net with c sharp) to send email on web.
Before post, please go through the forums guide lines. Did you search google before post it? Check Here
cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net
-
Hi, Here is a short example: var smtp = new SmtpClient { Host = ConfigurationManager.AppSettings["smtpserver"]}; var mail = new MailMessage { From = new MailAddress("me@me.com") }; mail.To.Add(new MailAddress("some@email.com")); mail.Bcc.Add(mail.From); mail.Body = "Testing"; mail.IsBodyHtml = true; mail.Subject = "Subject"; try { smtp.Send(mail); } catch (SmtpException) { //Error handling here } Hope that this helps.
-
Hi, Here is a short example: var smtp = new SmtpClient { Host = ConfigurationManager.AppSettings["smtpserver"]}; var mail = new MailMessage { From = new MailAddress("me@me.com") }; mail.To.Add(new MailAddress("some@email.com")); mail.Bcc.Add(mail.From); mail.Body = "Testing"; mail.IsBodyHtml = true; mail.Subject = "Subject"; try { smtp.Send(mail); } catch (SmtpException) { //Error handling here } Hope that this helps.
-
Thanks for your code. Anyways, how to code if we set validation for email if it doesn't contain "@"? Visoth
Hi, If you collects the e-mail adress from a web form you can use a RegularExpressionValidator like this: If you would like to check at the server level you can use a simple emailstring.Contains("@") to check before you try to send it.
-
Hi, If you collects the e-mail adress from a web form you can use a RegularExpressionValidator like this: If you would like to check at the server level you can use a simple emailstring.Contains("@") to check before you try to send it.
-
I understand your explain! Would you mind to give me your personal email address? Many thanks, Visoth
Hi, That I can do, don't want to post it here though. Could you reply to this with a private message with your adress?
-
Hi, That I can do, don't want to post it here though. Could you reply to this with a private message with your adress?