MATLAB sendmail函数的典型使用/调用如下所示:
% content
body = 'text';
attachments = 'attachment.pdf';
% set preferences
setpref('Internet', 'SMTP_Server', 'smtp.office365.com');
setpref('Internet', 'E_mail', 'first.last@domain.com');
setpref('Internet', 'SMTP_Username', 'first.last@domain.com');
setpref('Internet', 'SMTP_Password', '123456');
% properties
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth', 'true');
props.setProperty('mail.smtp.port', '587');
props.setProperty('mail.smtp.starttls.enable', 'true' );
% send message
sendmail(address, subject, body, attachment);我不能弄清楚的其他功能是如何指定抄送地址?
发布于 2021-06-19 21:24:38
MATLAB sendmail不是一个成熟的电子邮件客户端。它的目的是发送一封电子邮件,例如,通知你计算已经完成。因此,它不支持抄送或密送,也不支持HTML电子邮件,只支持纯文本电子邮件。
例如,如果您正在尝试使用sendmail向客户端发送电子邮件,则您使用的工具是错误的。
如果你是在Windows上,你可以使用use ActiveX/COM to communicate with the MS Outlook app,并用它来构造abs发送电子邮件。但可能有比MATLAB更好的工具来以编程方式发送大量电子邮件。
https://stackoverflow.com/questions/68046132
复制相似问题