Intercept send event

Add-in Express™ Support Service
That's what is more important than anything else

Intercept send event
 
Giancarlo




Posts: 67
Joined: 2016-08-17
I'll explain what I want to realize now.
Step A)
The user creates a new message.

When he presses the send button,
The plugin intercepts the event and asks for confirmation:

Are you sure?
If the user clicks No, the message is not sent, it remains in step A

If the user presses Yes, a ShowMessage show the entire email including MIME attachments

I have tried to use adxOutlookAppEvents1 component


procedure TAddInModule.adxOutlookAppEvents1NewMail(Sender: TObject);
begin
  ShowMessage('new mail');
end;


but it is not the event that i need
Posted 19 Aug, 2016 10:09:13 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Giancarlo,

See the ItemSend event of that component.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 19 Aug, 2016 10:25:55 Top
Giancarlo




Posts: 67
Joined: 2016-08-17
where I can find all the properties of this object Self.OutlookApp.ActiveInspector.CurrentItem ??



procedure TAddInModule.adxOutlookAppEvents1ItemSend(ASender: TObject;
  const Item: IDispatch; var Cancel: WordBool);
begin
  if Dialogs.MessageDlg('Are you sure?', mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then
  begin
    ShowMessage('How read the email content and recipients?');

  ShowMessage('The subject is: '+ CRLF
    + OleVariant(Self.OutlookApp.ActiveInspector.CurrentItem).Subject);

  OleVariant(Self.OutlookApp.ActiveInspector.CurrentItem).Subject := 'i change subject';


  end else begin
    Cancel := True;
  end;
end;
Posted 19 Aug, 2016 10:38:37 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
You need to cast it to _MailItem. See e.g. https://www.add-in-express.com/forum/read.php?FID=1&TID=6636 or https://www.add-in-express.com/forum/read.php?FID=1&TID=13015.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 19 Aug, 2016 10:53:43 Top