Note that there are some explanatory texts on larger screens.

plurals
  1. POOutlook code is working when manually called but giving trouble from Application_ItemSend
    text
    copied!<p>I have a code that checks the recipient of the mail, looks what organization is set in the address book for the recipient and dependent on that sets the "SentOnBehalfOfName"-property of the item. If the recipient is working for client2, he will get the mail from "we_love_to_serve_client2@domain.com".</p> <p>I call the code either before sending the mail via a button in my ribbon, that calls this Sub:</p> <pre><code>Sub Signatur() Dim olApp As Outlook.Application Dim objMail As Outlook.MailItem Set olApp = Outlook.Application Set objMail = Application.ActiveInspector.CurrentItem Call Signatur_auto(objMail) End Sub </code></pre> <p>I do this if I want to know which mail-adress is going to be chosen.</p> <p>In the itemSend-section of thisOutlookSession I also call the same sub</p> <pre><code>Call Signatur_auto(Item) </code></pre> <p>Part of the Signatur_auto (i do not copy that in, the question is too long already...) is dealing with the SentOnBehalfOfName-property, the other part is putting the item into the right folder. The Folder is chosen depending on the SentOnBehalfOfName-property.</p> <p>Now comes the interesting part: Although the folder-part is always working (which can only be when the SentOnBehalfOfName has worked before), the SentOnBehalfOfName only works "half". In the preview-line the mail sent is shown as from "we_serve_client2@domain.com", but when I open the mail it says it was sent by me. The Client always only sees my address, and also answers to my address - which I do not want....</p> <p>How cant be, that the same code is having different results dependent on where it is called? Is it a Problem to change the sendonbehalf-field in the item send-section?</p> <p>Thanks for any Inputs! Max</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload