Sendmail 'Authentication failed' error at office365.com
    15 views (last 30 days)
  
       Show older comments
    
Hi all:
I'm trying to configure sendmail to send me an email when something breaks.  I am having a hard time getting it to work with Office365.com.  I've been up and down the web and have found similar problems (with gmail, not office365) and have been learning a lot about java email settings, but have not been successful.
I have verified that I'm seeing the server, I get replies when I ping and see the server when I telnet over to smtp.office365.com.  I set up the account on Thunderbird and it sends mail just fine.  I've verified that 'authorized SMTP' is enabled at office365.com.  Running out of ideas on what else to try or how else to debug.
Here is what I am using:
mail = 'name@domain.org';   
password = 'xxx'; 
server = 'smtp.office365.com';
port = '587';
setpref('Internet','E_mail', mail);
setpref('Internet','SMTP_Server', server);
setpref('Internet','SMTP_Username', mail);
setpref('Internet','SMTP_Password', password);
props = java.lang.System.getProperties;
props.setProperty( 'mail.smtp.ssl.trust', server);
props.setProperty( 'mail.smtp.user', mail );
props.setProperty( 'mail.smtp.password', password );
props.setProperty( 'mail.smtp.host', server );
props.setProperty( 'mail.smtp.port', port );
props.setProperty( 'mail.smtp.starttls.enable', 'true' );
props.setProperty( 'mail.smtp.auth', 'true' );
sendmail('recipent@domain.org','Subject','Message')
It returns:
Error using sendmail (line 175)
Authentication failed.
Anyone have any ideas or thoughts on how to debug?
Thanks, Rob
3 Comments
  Markus Hohlagschwandtner
 on 26 Nov 2022
				I found the problem. SMTP AUTH hast to be disabled.
props.setProperty( 'mail.smtp.auth', 'false' );
Answers (1)
  Mehmet Ali
 on 3 Oct 2023
        When I am using this code I am getting an error :
Error using sendmail
530 5.7.57 Client not authenticated to send mail. [VI1PR0102CA0080.eurprd01.prod.exchangelabs.com
2023-10-03T15:12:54.961Z 08DBC367B59984EF]
Do you have any suggestion for this?
0 Comments
See Also
Categories
				Find more on Web Services in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!