1

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

mitkosoft
  • 5,262
  • 1
  • 13
  • 31
Mrug
  • 481
  • 1
  • 6
  • 21
  • Does this answer your question? [php.ini & SMTP= - how do you pass username & password](https://stackoverflow.com/questions/112190/php-ini-smtp-how-do-you-pass-username-password) – Nico Haase Feb 17 '20 at 11:15

0 Answers0