MATLAB Answers

0

Open and Close outlook from Matlab

Asked by Arnaud Bitoun on 9 Jan 2019
Latest activity Commented on by Arnaud Bitoun on 10 Jan 2019
I am using code to write outlook email;
h = actxserver('outlook.Application');
mail = h.CreateItem('olMail');
mail.To = myemail@email.com;
mail.Subject = 'Subject';
mail.BodyFormat = 'olFormatHTML';
mail.HTMLBody = 'Test';
I am looking how to close and open Outllok. How can I do ?
Thanks in advance,
Arnaud

  0 Comments

Sign in to comment.

Products


Release

R2016b

1 Answer

Answer by Kojiro Saito on 10 Jan 2019

I think you need to add
mail.Send;
to send email.
In order to close and then open Outlook,
%% Close Outlook
Quit(h)
delete(h)
%% Open Outlook
h = actxserver('outlook.Application');
mapi = h.GetNamespace('mapi');
INBOX = mapi.GetDefaultFolder(6);
INBOX.Display

  1 Comment

Thank you Kojiro,
Arnaud

Sign in to comment.