PDA

View Full Version : [SOLVED:] Enter alternative address in new mail "From" field



mdmackillop
05-25-2012, 04:40 AM
Using this as the basic code, I wan't to add a different email address to the "From" field in a new email. I can't locate the property for this.
Sub CreateHTMLMail()
'Creates a new e-mail item and modifies its properties
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><H2>The body of this message will appear in HTML.</H2><BODY>Please enter the message text here. </BODY></HTML>"
'@@@@@@@@@@@@@@@@@@@@@@
.From = "This fails here"
.Display
End With
End Sub

JP2112
05-29-2012, 12:58 PM
I think you want the SentOnBehalfOfName (http://msdn.microsoft.com/en-us/library/aa171998(v=office.11).aspx) Property.


Returns a String indicating the display name for the intended sender of the mail message. This property corresponds to the MAPI property PR_SENT_REPRESENTING_NAME. Read/write.