php.ini & SMTP= - how do you pass username & password


Question

My ISP account requires that I send a username & password for outbound SMTP mail.

How do I get PHP to use this when executing php.mail()? The php.ini file only contains entries for the server (SMTP= ) and From: (sendmail_from= ).

1
64
6/5/2015 7:33:49 PM

Accepted Answer

PHP mail() command does not support authentication. Your options:

  1. PHPMailer- Tutorial
  2. PEAR - Tutorial
  3. Custom functions - See various solutions in the notes section: http://php.net/manual/en/ref.mail.php
40
5/7/2015 1:13:43 PM

I apply following details on php.ini file. its works fine.

SMTP = smtp.example.com
smtp_port = 25
username = info@example.com
password = yourmailpassord
sendmail_from = info@example.com

These details are same as on outlook settings.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon