Monday, December 4, 2006

Send Mail using CDONTS

CDO is microsoft inbuild component to send EMail,
To send a mail firts add a reference(Project-> Add Reference -> in the COM tab choose the microsoft CDO library)
then use the below code.

Dim oMsg As CDO.Message = New CDO.Message
oMsg.From = strFrom
oMsg.To = strTo
oMsg.Subject = strSub
strBody = "email"
oMsg.TextBody = strBody
oMsg.Send()
oMsg = Nothing

Using this tyou can send a mail with SMTP.

No comments: