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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Mar 16, 2010, 3:50 PM
Hirendra SisodiyaPosted Mar 16, 2010, 7:21 AM
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
Lalit MPosted Mar 16, 2010, 5:06 AM
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