MATLAB で Outlook からの電子メールのメ​ッセージを読み取るに​はどうすればよいです​か?

Outlook からの電子メールに対してテキスト分析を実行しようとしており、MATLAB を使用したいと考えています。方法を教えてください。
 

 Risposta accettata

MathWorks Support Team
MathWorks Support Team il 11 Set 2024

0 voti

MATLAB から他の Microsoft アプリケーションを制御できる ActiveX/COM インターフェイスを使用することで可能です。
MATLAB では actxserver コマンドにより MATLAB 上に COM インターフェースで接続した Outlook のオブジェクトを作成し、その後はそのオブジェクトを使用して Outlook のメソッドを使用することになります。
Outlook オブジェクトのプロパティとメソッドについてはそのドキュメントを参照ください。
https://learn.microsoft.com/ja-jp/office/vba/api/overview/Outlook/object-model
以下のコードは、MATLAB で Outlook から電子メールを読み取る方法の簡単な例を示しています。
function mailText = readAnEmail()
    h = actxserver('outlook.Application');
    outlookSpace = h.GetNamespace("MAPI");
    % Item 6 is for the inbox folder.
    inboxFolder = outlookSpace.GetDefaultFolder(6);
    items = inboxFolder.Items;
    % Read the first email
    mailText = items.GetFirst().Body;  
end
参考ですが、このワークフローを使用して電子メールを送信する方法の例は、次の MATLAB Answers の投稿に記載されています。
https://jp.mathworks.com/matlabcentral/answers/94446-can-i-send-e-mail-through-matlab-using-microsoft-outlook

Più risposte (0)

Categorie

Scopri di più su 起動と終了 in Centro assistenza e File Exchange

Prodotti

Release

R2020b

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!