'Call to the function for sending the mail on mail id 'abc@abc.com' Call SendMail("abc@abc.com","Hi","Hi","") ' THis function will create an email and send it using outlook Function SendMail(SendTo, Subject, Body, Attachment) 'CreateObject method to create an Outlook Application object Set ol=CreateObject("Outlook.Application") 'Create a new outlook mail object Set Mail=ol.CreateItem(0) 'Add the email address to the recipient list of the message Mail.to=SendTo 'Add the subject of the message Mail.Subject=Subject 'Add the body of the mail message Mail.Body=Body 'Add the attachment to the mail message If (Attachment <> "") Then Mail.Attachments.Add(Attachment) End If 'Send the mail message Mail.Send 'Free up the memory ol.Quit Set Mail = Nothing Set ol = Nothing End Function
Interested in more QTP codes? click here
How to keep more than one person in CC ?
ReplyDeleteNice question, I never had a chance to try this one. I guess separating out the email ids with a ; should be handy.
ReplyDeleteAlso, In the SendMail function add a new parameter for cc. Add the line "Mail.cc="
Hi guys,
ReplyDeleteFor the above script i am getting " General run error "
at mail.send line, can anybody help to solve the error. And can tell me what other changes i have to do.
Shiri
What can this thing do? Email you when the script fail?
ReplyDeleteTo keep more than one in CC:
ReplyDeleteObjectName.CC = "email1@email.com,email2@email.com"
Can we pickup email id from excel sheet to send multiple mails.
ReplyDeleteCan we pickup the email ids from the xcel sheet to attache multiple recipents.
ReplyDelete