0
votes

i have Outlook plugin that open popup window after user click on "Send" button. In this window user choose email sender. So i use "ItemSend" event and if i change "SendOnBehalf" property inside this event than Outlook just overite my changes so i should do it before "ItemSend" i found only one event before "ItemSend" it's "BeforeCheckNames" but i can't use it because than my popup window open many times. So my last idea maybe i can hide standard button "Send" and put my button for send email than i can make my changes and after that say email.Send(). I found that this question was asked before Replace the Outlook 2010 Send-Button? but there is no answer. Maybe you have any ideas? Thank you for help

3

3 Answers

1
votes

No, the Send button cannot be hidden. Why not add a combobox to the ribbon and let the user specify the sender before sending? You can set SendOnBehalf as soon as the user selects a value from the combobox.

1
votes

Alternatively you could amend your ItemSend code. The SentOnBehalfOfName will stick to a copied item.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim copiedItem As MailItem

If Item.Class = olMail Then

    Set copiedItem = Item.Copy

    copiedItem.SentOnBehalfOfName = "[email protected]"
    'copiedItem.Display
    copiedItem.Send

    Item.Delete
    Cancel = True

End If

    Set copiedItem = Nothing

End Sub
1
votes

Another option is to use the Replacement or Replace-all form region types that allow to replace the standard form completely.

  • Replacement - Adds the form region as a new page that replaces the default page of an Outlook form.
  • Replace-all - Replaces the whole Outlook form with the form region.

See Creating Outlook Form Regions for more information.