I am trying to put together a draft email from within a vb6 application using the Outlook object.
The following code does what I need - it frames the email - but I need to go one step further be able to pre-select the sender's email address and the relevant signature that goes with it.
Private Function DoMailMerge(ContactLink As Long)
Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.Application")
Set objMailItem = objOutlook.CreateItem(0) 'The constant olMailItem = 0
strSender = cboSender.Text
If Trim(strSender) = "" Then
MsgBox "Select the sender.", vbExclamation
strBody = "Your Reference : " & Trim(txt(24).Text) & "<br>"
strBody = strBody & "Our Reference : " & "<br>"
'.SenderEmailAddress = strSender 'read only property
.To = Trim(txt(6).Text)
.Importance = olImportanceHigh
.ReadReceiptRequested = True
.Subject = Replace(Trim(txt(22).Text), vbCrLf, " - ", 1)
.BodyFormat = olFormatHTML
.HTMLBody = strBody
Set objOutlook = Nothing
Set objMailItem = Nothing
In Outlook I have two email address under one profile. I am at present manually selecting the email account I want to send the email from and manually inserting the relevant signature.
I would like to programmatically do this ...