Today I am going to show you how to send email using PHP. You can send mail from your server using PHP mail() function. Let's see how to work with this function. normally mail() function works with these parameters mail($tomail, $subject, $message, $headers) here $tomail is targetd mail , $subject is email subject , $message is email body that means message and $headers is for mail configaration. Here is a simple code of mail sent.
if we will execute this script then server will send an email from admin[at]phpans.com to info[at]phpans.com , You can change your target if you want. Now we are going to create a script for send mail from the server. Create a file name as index.php and write down this code into this file.
This script is ready for use , you need to change some value like $from as your server domain name. If you execute this script then you can send email from your server. If you will not change $from variable value then It may send mail into the spam box. So, it's most important to config with the server.
You can use mail function for the email newsletter or inform users important notice/updates about your website. Hope it will be helpful for you.