Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

email

smtp

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= ).

like image 506
Charles Faiga Avatar asked Sep 21 '08 21:09

Charles Faiga


People also ask

What is a PHP ini?

Overview. The php. ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits.

Where can I find PHP ini file?

For Windows, you can find the file in the C:\xampp\php\php. ini -Folder (Windows) or in the etc -Folder (within the xampp-Folder). Under Linux, most distributions put lampp under /opt/lampp , so the file can be found under /opt/lampp/etc/php.

Do I need a PHP ini?

ini file is a special file for PHP. It is where you declare changes to your PHP settings. The server is already configured with standard settings for PHP, which your site will use by default. Unless you need to change one or more settings, there is no need to create or modify a php.


2 Answers

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
like image 184
daremon Avatar answered Oct 20 '22 22:10

daremon


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

SMTP = smtp.example.com
smtp_port = 25
username = [email protected]
password = yourmailpassord
sendmail_from = [email protected]

These details are same as on outlook settings.

like image 27
sugunan Avatar answered Oct 20 '22 22:10

sugunan