Email sending code using .net code
i need email sending code in .net
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Lalit MRank #1,186 · 1.5K reputationPosted Mar 16, 2010, 1:06 AM EDT
http://csharpdotnetfreak.blogspot.com/2009/10/send-email-with-attachment-in-aspnet.html
http://csharp.net-informations.com/communications/csharp-smtp-mail.htm
http://www.codersource.net/microsoft-net/c-basics-tutorials/sending-emails-in-c.aspx
http://aspalliance.com/149
Hirendra SisodiyaRank #258 · 9.8K reputationPosted Mar 16, 2010, 3:21 AM EDT
if you want to send mail through outlook than you can use this code :
Dim outLookApp As New Outlook.Application()
Dim mailItem As Outlook.MailItem = outLookApp.CreateItem(Outlook.OlItemType.olMailItem)
mailItem.CC = strCC 'Add your 'Cc address
mailItem.BodyFormat = Outlook.OlBodyFormat.olFormatPlain
mailItem.Body = strBody 'Message
mailItem.Subject = strSubject 'Subject
mailItem.Send()
'if you want to send by another mail (yahoo, gmail etc ) than you can use this.
Dim message As New MailMessage()
message.[To] = strEmailTo 'To address
message.Cc = strCC 'Cc address
message.From = strFrom
message.BodyFormat = MailFormat.Text
message.Subject = strSubject 'Subject
message.Body = strBody 'Message
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", AuthenticateUser)
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", AuthenticatePassword)
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 2)
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", SmtpPort number)
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", True)
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60)
System.Web.Mail.SmtpMail.SmtpServer = SmtpServer
System.Web.Mail.SmtpMail.Send(message)
thanks
check answere if you like my answere
Sam HobbsRank #107 · 20.5K reputationPosted Mar 16, 2010, 11:50 AM EDT