File Exchange

image thumbnail

Read / Scraping emails from Microsoft Outlook

version 1.1.0.0 (5.8 KB) by Ioannis Kyriakos
Read Outlook

2 Downloads

Updated 27 Aug 2017

From GitHub

View Version History

View license on GitHub

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');

Cite As

Ioannis Kyriakos (2021). Read / Scraping emails from Microsoft Outlook (https://github.com/KyriakosJiannis/Matlab-read-Outlook), GitHub. Retrieved .

Comments and Ratings (9)

Daniel Vieira

Axel Ahrens

Great work! Thank you!

Steve Wood

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

Marcel

James McArthur

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

Omer Yasin Birey

Ward

Typo at line 137: should be 'if f.Mark...' instead of 'if Mark...'

Ioannis Kyriakos

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

Sébastien MAILFERT

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

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!