- The sendmail function does not support HTML-formatted messages. However, you can send HTML files as attachments.
MATLAB email body include text and a table
9 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I would like to include into an email body apart from text, also a table.
For example:
This is a test email
'Alberta' '2020-07-20 00:00:00.0' '2021-05-03 00:00:00.0' 'no action needed' 'no action needed'
'Aristarchos' '2017-09-14 00:00:00.0' '2020-12-12 00:00:00.0' 'no action needed' 'action needed'
'Balos' '2018-05-22 00:00:00.0' '2020-12-20 00:00:00.0' 'no action needed' 'no action needed'
I tried to modify the sendmail function with below code:
~isempty(charset)
msg.setText(body, charset, 'html');
else
msg.setText(body, '', 'html'); %not sure an empty charset will work
end
but the result was that I couln't add the text only the table but not with the required format but simple single rows as per below:
Alberta
Aristarchos
Balos
2020-07-20 00:00:00.0
2017-09-14 00:00:00.0
2018-05-22 00:00:00.0
2021-05-03 00:00:00.0
2020-12-12 00:00:00.0
2020-12-20 00:00:00.0
no action needed
no action needed
no action needed
no action needed
action needed
no action needed
How can I achieve the required format?
Thank you in advance!!
0 个评论
采纳的回答
Geoff Hayes
2021-5-20
So you might want to try converting your cell array into an HTML table and attach that to your message. Else, you could try converting each row of your cell array into a single string and include that in your message body (assuming that the text is no longer than 75 characters, I think that it all should be written to one line in the message).
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Web Services 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!