- 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
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Fragkiskos Nikolakis
el 20 de Mayo de 2021
Comentada: Fragkiskos Nikolakis
el 21 de Mayo de 2021
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 comentarios
Respuesta aceptada
Geoff Hayes
el 20 de Mayo de 2021
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).
Más respuestas (0)
Ver también
Categorías
Más información sobre Web Services en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!