Hello, I'm using this function to send mail through Outlook with matlab:
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.Body = body;%mail.BodyFormat = 'olFormatHTML';
%mail.HTMLBody = body;
% Add attachments, if specified.
if nargin == 4 for i = 1:length(attachments) mail.attachments.Add(attachments{i}); endend% Send message and release object.
mail.Send;h.release;
The problem is that I have two different mail addresses in Outlook. How can I specify from which mail to send?? Thanks!
Best Answer
Try add this before mail.Send