Sending Emails with MATLAB

79 Ansichten (letzte 30 Tage)
Brian Gregory
Brian Gregory am 14 Jun. 2021
Kommentiert: Adam Danz am 14 Jun. 2021
Hello,
I am currently running a script in matlab that sends an email out when it is through with a .pdf attachment. This was working flawlessly two days ago and now I can't seem to get it to work.
I am recieving the following error message:
Error using sendmail (line 175)
530 5.7.57 Client not authenticated to send mail. [BLAP220CA0019.NAMP220.PROD.OUTLOOK.COM]
Here is my code:
mail = 'email@address.com'; % false email for forum
password = 'password'; % false pass for forum
mailingList = {'people@email.com'}; % false email for forum
server = 'smtp-mail.outlook.com';
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.port','587');
props.setProperty('mail.smtp.starttls.enable','true');
setpref('Internet','E_mail',mail);
setpref('Internet','SMTP_Server',server);
setpref('Internet','SMTP_Username',mail);
setpref('Internet','SMTP_Password',password);
messageBody = sprintf(' Good morning team!');
messageBody = sprintf('%s\n\n Here is the data analysis from yesterdays data. Have a great day!', messageBody);
messageBody = sprintf('%s\n\n - Brian Gregory', messageBody);
messageBody = sprintf('%s\n\n\n *This email was generated and sent automatically via MATLAB', messageBody);
sendmail(mailingList, ...
"Data Analysis - "+date, ...
messageBody,fileDir7);

Akzeptierte Antwort

Adam Danz
Adam Danz am 14 Jun. 2021
Bearbeitet: Adam Danz am 14 Jun. 2021
You probably have to re-enable the feature in your email account (more info for gmail).
If you're using gmail, the link to enable less secure app acces: https://myaccount.google.com/lesssecureapps
Make sure it's turned on.
If that's not the problem I'll remove this answer so your questions is recategorized as unanswered.
  4 Kommentare
Brian Gregory
Brian Gregory am 14 Jun. 2021
Yeah I was using outlook but I couldn't figure this feature out on it so I made a gmail because it's easier to manage in my opinion.
Adam Danz
Adam Danz am 14 Jun. 2021
If you aren't doing this already, I recommend creating an dedicated gmail account for this purpose that is isolated from your google profile. This opens the doors to security problems but there's no way around it.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Call Web Services from MATLAB Using HTTP finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by