Send E-mail with VBA code from [E-mail Distribution Group] if I have “Send as”

Status
Not open for further replies.

lgnfox

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Send E-mail with VBA code from [E-mail Distribution Group] if I have Send as

Good afternoon.

I know that subject of my question is not new, but I can’t find good solution.

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”,

From.jpg

but I don’t know how to do this in VBA.

There are some methods:
  1. SendUsingAccount doesn't fit because I can’t adjust [Account distribution group] in the [Outlook client] as [Outlook account]. In addition I can send E-mail manually from [Distribution Group] without it.
  2. SentOnBehalfOfName isn’t correct method, because it changes only SentOnBehalfOfName property, and receiver can see real sender in SenderEmailAddress (SenderName) properties, although I have “Send as” permission.
  3. SenderEmailAddress (SenderName) could be read only
  4. Anything else
For test I use Rule, which runs when test E-mail came in:

Code:
Sub CustomMailMessage_111111111111(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("Fokin@lgn.ru") 
 
objOutlookRecip.Type = olTo 
 
' objOutlookMsg.SenderEmailAddress = "OBT_Group@XXX.ru" 
 
objOutlookMsg.Subject = "HRU" 
 
'Будем отправлять все письма в HTML иначе приходящие пути к папкам у пользователей не подсвечиваются 
 
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

How can I send E-mail with VBA code from [E-mail Distribution Group] if I have “Send as” permission (not using SentOnBehalfOfName property)?
 

lgnfox

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Re: Send E-mail with VBA code from [E-mail Distribution Group] if I have Send

It's a pity. Thanks a lot for response.
 

lgnfox

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Re: Send E-mail with VBA code from [E-mail Distribution Group] if I have Send

I'm checking on this, but i seem to recall that you can't SendAs using VBA.

It's possible to do, I managed to send E-mail with VBA code from [E-mail Distribution Group] with “Send as” permission.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Re: Send E-mail with VBA code from [E-mail Distribution Group] if I have Send

My guy said you need to use SentOnBehalfOfName to do it - is that what you used or did you so it some other way.
 

lgnfox

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Re: Send E-mail with VBA code from [E-mail Distribution Group] if I have Send

My guy said you need to use SentOnBehalfOfName to do it - is that what you used or did you so it some other way.

I tried to use SentOnBehalfOfName but one didn’t fit, because it changed only SentOnBehalfOfName property, and receiver could see real sender in SenderEmailAddress and SenderName properties.

I’ve read many articles and found MailItem.Sender Property: Read/write (http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._mailitem.sender.aspx#Y0).

I used it :)))
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Re: Send E-mail with VBA code from [E-mail Distribution Group] if I have Send

Cool. I'll be sure to rub it into my dev guy. <g>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
stephen li VBA Outlook send mail automatically by specified outlook mail box Outlook VBA and Custom Forms 1
D VBA Script (Ask to where to save send mail) Outlook VBA and Custom Forms 1
S Outllok 2007 VBA code to send mail automatically from drafts folder Using Outlook 1
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
soadfan Outlook won't send e-mail when offline Outlook VBA and Custom Forms 19
K Delay Send and Mail Merge Outlook VBA and Custom Forms 4
undercover_smother Automatically Forward All Sent Mail and Delete After Send Outlook VBA and Custom Forms 10
I Outlook 2013 Send mail - it just sticks in Outbox Using Outlook.com accounts in Outlook 0
Tim King Send mail from MSWord through Outlook Using Outlook 3
R OL2010 - Send to Mail Recipient going to wrong account Using Outlook 1
R Unable to send mail using Cox.net Using Outlook 1
Emerogork How do I activate the "Send Again" option in Sent Mail folder? Using Outlook 1
S Check if two organisition is added then i have to give managers passward creteria to send mail Using Outlook 1
A Application_ItemSend not accessed when sending email outside outlook (i.e. word or send to mail from Using Outlook 7
D Create additional custom flag descriptions (other than Send E-Mail, Call etc.) Using Outlook 1
A yahoo mail doesn't send or receive reliably Using Outlook 1
Z Send mail and contents of body from ms word document Using Outlook 1
H Outlook 2010 unable to send iCloud account e-mail after iOS 7 upgrade Using Outlook 12
C Insert a Date Picker for Send Mail Subject Using Outlook 1
C MsgBox Everytime I send a mail Using Outlook 1
L "sometimes" cant send mail, we have to copy and paste the message and resend? Using Outlook 2
K A program is trying to send an e-mail message on your behalf... Using Outlook 1
A How to send Personalized attachment while sending mass mail Using Outlook 1
G Rule: IF mail received by X, THEN no action; IF mail not received by X, SEND Using Outlook 0
E Outlook cannot connect to your incoming (POP3) e-mail server/Cannot send mess. Using Outlook 0
T HELP - Send e-mail verification text box Using Outlook.com accounts in Outlook 10
B How do I create and send mail in Outlook 2003 from code? Using Outlook 5
J Outlook 2003 does not send or receive imap mail from server Using Outlook 0
R OL10 - Send To "Mail Recipient" doesn't go to default email account Using Outlook 23
G When I send a mail from my draft folder, the formatting get messed up Using Outlook 2
A Recent impossibility to send e-mail to some customers using Outlook 2007. Using Outlook 2
T Why don't my send button will not send mail from keyboard? Using Outlook 10
B Outlook 2010 wont send mail today Using Outlook 9
S Remove modal window when sending through IE's 'Send Page by E-mail' Using Outlook 2
T How can I send e-mail from an Access 2010 application using Outlook not CDO Using Outlook 1
W MS Office no longer RECEIVES ANY MAIL (But will still SEND MAIL) Using Outlook 2
M Right Click &gt; Send to Mail Recipient, has no effect__Other programs cannot access the email client Using Outlook 3
C Outlook 2007 won't send/revieve posts until some mail is archived Using Outlook 1
D Setup Outlook '07 to Send/Receive mail from 2 Domains??? Using Outlook 11
T Can't receive or send e-mail in Outlook after downloading latest Windows updates on Tuesday, 14 Dec 2010, at 6:00 pm. Using Outlook 3
M 'Send link by E-mail' doesn't provide active link.__ Using Outlook 1
M when I try to send e-mail it does not show send button Using Outlook 2
G Ihave 4 accounts in office 2010, all of them receive mail, but only one allows me to send, other accounts gives me error cannot be reached '550 #5.1.0 Using Outlook 2
A Unable to send E-mail when it is being replied. Using Outlook 2
O Send Mail Via Outlook Even If Outlook Is Closed Using Outlook 4
M How can I delete an e-mail from Outlook send box that is to big to send? Using Outlook 2
L Delay / Send outgoing mail during certain hours Using Outlook 1
K No "Send" button in Outlook 2010 Mail Using Outlook 3
S Suddenly I am not able to send e-mail but can receive. We use Windows7 and Outlook has been working for about a year. Using Outlook 2
A Outlook 2007 periodically (1-2 times per day)locks up when trying to send email. I digitally sign all mail. When Outlook became non-responsive Using Outlook 2

Similar threads

Top