This is from Send E-mail with VBA code from [E-mail Distribution Group] if I have “Send as”
I need to send message from the certain E-mail address (E-mail Distribution Group) with VBA code. I have permission “Send as” and I can do it by hands, changing field “From”.
You can do this using _MailItem.Sender Property
VBA code Sample
Sub CustomMailMessage_1(Item As Outlook.MailItem)
Dim OutApp As Outlook.Application
Set OutApp = CreateObject("Outlook.Application")
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
'Create the message.
Set objOutlookMsg = OutApp.CreateItem(olMailItem)
Set objOutlookRecip = objOutlookMsg.Recipients.Add("me@domaain.com")
objOutlookRecip.Type = olTo
' objOutlookMsg.SenderEmailAddress = "sendas_address@domain.com"
objOutlookmsg.MailItem.Sender = "sendas_address@domain.com"
objOutlookMsg.Subject = "HRU"
'Create the body
objOutlookMsg.HTMLBody = "HRU" & vbCrLf & vbCrLf
objOutlookMsg.Importance = olImportanceHigh 'High importance
'Resolve each Recipient's name.
For Each objOutlookRecip In objOutlookMsg.Recipients
objOutlookRecip.Resolve
Next
objOutlookMsg.Save
objOutlookMsg.Send
Set OutApp = Nothing
End Sub

