My php.ini settings:
SMTP = smtp.office365.com
; http://php.net/smtp-port
smtp_port = 587
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = test@test.com
auth_username = test@test.com
auth_password = test123455@
smtp_ssl=tls
and I send mail using mail function:
//proceed with PHP email.
$headers = 'From: '. $user_email .'' . "\r\n" .
'Reply-To: '.$user_email.'' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$send_mail = mail($to_email, $subject, $message_body, $headers);
But I get error:
PHP Warning: mail(): SMTP server response: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [LO2P265CA0170.GBRP265.PROD.OUTLOOK.COM] in D:\Company Website\abc\assets\php\mailer.php on line 44