Matlab function which imports the 'readed' or 'unreaded' outlook emails from inbox and their folders - subfolders.
Extracts their subjects, bodies and can save their attachments.
% Reads all emails from inbox
mails = ReadOutlook;
% Reads all Unread emails from inbox
mails = ReadOutlook('Read', 1);
% Reads all Unread emails from inbox and mark them as read
mails = ReadOutlook('Read', 1, 'Mark', 1);
% Reads all emails from a email folders and save their attachments
mails = ReadOutlook('Folder', 'Groups', 'Savepath', 'C:\matlab\data\test');
Ioannis Kyriakos (2021). Read / Scraping emails from Microsoft Outlook (https://github.com/KyriakosJiannis/Matlab-read-Outlook), GitHub. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
Great work! Thank you!
Hi Loannis,
Thanks for this code, I am hoping it will help me get some data from some specific emails. Unfortunately those emails are in a PST file that is saved and then imported to outlook. Is there a way to address a linked PST file rather than the usual inbox?
Thanks,
Steve
hi,
thanks for the code,
I'm getting operation aborted on the body of the email though
does manage to grab the subject but not quite the body.
I get operation aborted, also in the actxserver connection part
could be a number of reasons
Thanks again
James
Typo at line 137: should be 'if f.Mark...' instead of 'if Mark...'
Dear Mailfert,
I am very happy that you enjoy using this function.
It looks really interesting question, but unfortunately, I have not Outlook+Matlab/Octave on my current machine to play around. I will try to check it during the next weeks.
Meanwhile, I suggest to
1) set a debug point at 162 (line) if UnRead,
2) then, check how the "email" object looks in Matlab, [you may send me a screenshot at kyriakos.giannis@gmail.com to have a look too]
3) in case that it is possible, then we have to add after 165 line: body = email.get('Body'); which extracts the email's body, the one that extracts the date (if exist) and modify the output.
Best, Ioannis
Dear Kyriakos,
I’m really happy to use your code to read emails content.
Could you help me to retrieve the date of the email please?
Best regards.
Sébastien