How to configure php ini file to send mail

To configure the PHP ini file to send mail, you'll need to set the following settings:

  1. SMTP settings: You'll need to specify the SMTP server, port, and authentication details.
  2. Mail function: You'll need to specify the mail function to use (e.g., mail(), sendmail(), or smtp()).
  3. From email address: You'll need to specify the from email address that will be used as the sender's email address.

Here's an example of how you can configure the PHP ini file to send mail using SMTP:

; SMTP settings
SMTP = "your_smtp_server.com"
smtp_port = 587
smtp_auth = "PLAIN"
smtp_username = "your_smtp_username"
smtp_password = "your_smtp_password"

; Mail function
mail_function = "smtp"

; From email address
sendmail_from = "[email protected]"

You can add these settings to your PHP ini file, which is usually located at /etc/php.ini (on Linux) or C:\php\php.ini (on Windows).

Here's a breakdown of each setting:

Once you've added these settings to your PHP ini file, you can test your mail configuration by using the mail() function in a PHP script:

<?php
mail("[email protected]", "Subject", "Hello, world!");
?>

This should send an email to the recipient using the SMTP settings you configured in your PHP ini file.

Note: Make sure to replace the placeholders (your_smtp_server.com, your_smtp_username, your_smtp_password, etc.) with your actual SMTP server and authentication details.