PHP mail() function is used to send the email inside the script.
Note: for the mail function to be used, PHP requires an working email system, you can activate the email system in your php.ini file.
Syntax
mail(to,subject,message,headers,parameters)
Parameters
to – Required and filled with receiver email.
subject – Required and filled with Subject of the Email.
headers – Optional and filled with additional headers like From, CC, BCC.
parameters- Optional and filled with additional parameters of mail system
Example of Sending Email
<?php
$to = “support@ataaso.com”;
$subject = “Hi! This is an test email”;
$body = ” This is an sample email massage”;
$headers = “From: abc@xyz.com”;
mail($to,$subject,$message,$headers);
?>
This is an simple code which allowed you to send an email using PHP engine.
