by M.Hari Hara Subramanian (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 3rd February 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Send Mail Using Visual Basic
API Declarations
Dim iConf As CDO.Configuration
Dim str As String
'add reference ' Microsoft CDO Exchange 2000 Library
Set iConf = CreateObject("CDO.Configuration")
Set iFields = iConf.Fields
iFields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' SMTP
iFields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.0.1"
iFields.Update
Set cdoObj.Configuration = iConf
str = vbNullString
cdoObj.Subject = "Hai Check mail"
str = str & " <html> hai this is a check mail"
str = str & " </html>"
cdoObj.HTMLBody = str
cdoObj.To = "" 'type your friend email id
cdoObj.CC = ""
cdoObj.From = "" ' type your mail id
cdoObj.Send
MsgBox "Mails send sucessfully"