- create an email and see the on email send event
- create a copy of an email that is being sent
I.E, for my example, I'm trying to send the same customized email to multiple salesforce cases, so I need to capture the customized email, and change the subject a bit each time
Watch out! the 'global Email' is important. If you don't create that, you won't have access to the email you just created from the _Send event, so you won't be able to see subject / body / ect.
Code: Select all
ol := ComObjCreate("Outlook.Application")
global Email
ns := ol.getNamespace("MAPI")
ns.logon("","",true,false)
Email := ol.CreateItem(0) ;0 is the constant to create a mailItem
emailBody:="Lorem ipsum dolor sit amet, consectetur adipiscing elit"
emailSubject:="my first subject"
emailSubject2:="my second subject"
toAddress:="[email protected]"
olFormatHTML := 2 ;2 is the constant for HTML
Email.BodyFormat := olFormatHTML
Email.Subject := emailSubject
Email.HTMLBody := emailBody ;assign our HTML body
Email.To:=toAddress
Email.Display
ComObjConnect(Email,"Email_")
Email_Send(Cancel) {
secondMail := Email.Copy
secondMail.Display
}