I want to send email from my PHP code, but I received warning messages. So what are the php.ini parameters to set ?
To check/change your PHP mail configuration:
Open your php.ini file (if you don't know where this is, see below) Search for the line that reads [mail function] Add/change the details of your mail server. This could be a local mail server or the mail server of your ISP. Save/close the php.ini file Restart your web server
An example of what the mail settings could look like when you first open the php.ini file:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = [email protected]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
Additional info is in echoing phpinfo()
you can view your PHP configuration details. You can do this by creating a .php file with the following line on it: <?php phpinfo(); ?>
. When you run this in your browser, you will see a full list of PHP configuration variables. Simply search for the lines that contain php.ini and sendmail_path
to see the values you need to use.
Another idea is you might use ini_set()
to properly config your mail setting like this
Add the following code to the top of your email script if your mail script continues to fail.
// Please specify your Mail Server - Example: mail.example.com.
ini_set("SMTP","mail.example.com");
// Please specify an SMTP Number 25 and 8889 are valid SMTP Ports.
ini_set("smtp_port","25");
// Please specify the return address to use
ini_set('sendmail_from', '[email protected]');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With