Sending HTML formatted e-mail using QTP DOT Net factory. In the below code I have used Gmail account. You may try with other accounts also.
Dim vStUserName,vStPassword,vStServerName
vStUserName="Gmail Account Username"'Enter your Gmail Account User Name
vStPassword="Gmail Account Password"'Enter Your Gmail Account Password
vStServerName="smtp.gmail.com"'Gmail SMTP Server Name
vStFromAddress="FromAddress@gmail.com"'Enter valid From Address
vStToAddress="ToAddress@yahoo.com"'Enter Valid To Address
Set oCredentials=DotNetFactory.CreateInstance("System.Net.NetworkCredential","System",vStUserName,vStPassword)
Set oSMTPClient=DotNetFactory.CreateInstance("System.Net.Mail.SmtpClient","System",vStServerName)
Set oMessage=DotNetFactory.CreateInstance("System.Net.Mail.MailMessage","System")
Set oFromAddress =DotNetFactory.CreateInstance("System.Net.Mail.MailAddress","System",vStFromAddress)
oMessage.From=oFromAddress
oMessage.To.Add vStToAddress
oMessage.IsBodyHtml=True'If your message to be formatted with HTML, then make this property value as True or else False.
oMessage.Subject = "GMail Test"'Subject of your email
oMessage.Body = " This is the test text for Gmail email"
oSMTPClient.Port = 587
oSMTPClient.Credentials=oCredentials
oSMTPClient.EnableSSL = True
oSMTPClient.Send(oMessage)
'Kill All the objects
Set oMessage=Nothing
Set oFromAddress=Nothing
Set oCredentials=Nothing
Set oSMTPClient=Nothing