sendmail.m and HTML emails

I often use sendmail.m using gmail on win7 to send emails to myself when simulations have finished running etc.
sendmail.m allows for attachements and also allows for text.
does anyone know if sendmail.m (or anything else for that matter) can support imbedded images as per the HTML option of MS Outlook?
ie when a user recieves an email in outlook, they do not have to open a jpeg attachment, but the image is in the body of the text.
thanks

4 comentarios

Matlab2010
Matlab2010 el 6 de Feb. de 2013
Thank you for contacting technical support with the SR-number "1-LEW6ER" and topic "sendmail.com".
The ability to send embedded images in e-mails is not available in MATLAB.
If you are sending from a Windows computer with Outlook installed, one possible workaround is to use Outlook from within MATLAB. On Windows systems, you can send email directly through Outlook by accessing the COM server with actxserver. For more information, please refer to the following link:
Microsoft's Outlook may provide functionality for embedding images through its COM interface.
I hope this information was helpful for you.
Please preserve the THREAD ID below in any further correspondence on this query. This will allow our systems to automatically assign your reply to the appropriate Service Request. If you have a new technical support question, please submit a new request here:
Best regards
Christoph Stockhammer
Technical Support Engineer MathWorks www.mathworks.com/myservicerequests +49-89-45235-6700 option 4 MathWorks GmbH | Friedlandstr.18 | 52064 Aachen | District Court Aachen | HRB 8082 | Managing Director: Andreas Schindler, Steven D. Barbo
[THREAD ID: 1-LEW6ER]
Matlab2010
Matlab2010 el 6 de Feb. de 2013
Editada: Matlab2010 el 6 de Feb. de 2013
function test_SENDMAIL_OUTLOOK()
recipients = 'me@gmail.com';
emailSubject = 'Test subject';
textBody = 'Test message including an image';
imageBody1 = '
<<D---folder--Personal--blah.jpg>>
';
imageBody2 = '
<<D---folder--Personal--blah2.jpg>>
';
mainBody = [textBody '<p>' imageBody1 '<p>' imageBody2];
attachement1 = 'D:\folder\Personal\blah.PDF';
attachement2 = 'D:\folder\Personal\blah2.PDF';
attachements = {attachement1 attachement2};
sendolmail(recipients,emailSubject, mainBody, attachements);
end
function sendolmail(to,subject,body,attachments)
%Sends email using MS Outlook. The format of the function is
%Similar to the SENDMAIL command.
% Create object and set parameters.
h = actxserver('outlook.Application');
mail = h.CreateItem('olMail');
mail.Subject = subject;
mail.To = to;
mail.BodyFormat = 'olFormatHTML';
mail.HTMLBody = body;
% Add attachments, if specified.
if nargin == 4
for i = 1:length(attachments)
mail.attachments.Add(attachments{i});
end
end
% Send message and release object.
mail.Send;
h.release;
end
Image Analyst
Image Analyst el 6 de Feb. de 2013
Sometimes email programs (like Yahoo.com) will automatically embed attached images in the body of the message. I'm not sure if yours does or not.
Jens Koopmann
Jens Koopmann el 15 de Nov. de 2015
Cool that works really well Thanks for sharing

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 6 de Feb. de 2013

0 votos

Do you mean something like embedding this in the HTML message:
<<data-image-gif-base64-R0lGODlhEAAOALMAAOazToeHh0tLS-7LZv-0jvb29t-n--f3--Ub--ge8WSLf-rhf-3kdbW1mxsbP--mf---yH5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky-n-67QZ1hLnjM5UUde0ECwLJoExKcppV0aCcGCmTIHEIUEqjgaORCMxIC6e0Cc-n-guWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj.gAwXEQA7>>

Etiquetas

Preguntada:

el 17 de Mayo de 2012

Comentada:

el 15 de Nov. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by