Sending Mail from PHP Using SMTP– Example
PHP mail() function
You can be easily sent using the mail function. These functions have 4 arguments to send E-mails from a PHP web page. The parameters of this function are as follows:
• Recipient E-mail address
• E-mail Subject
• E-mail message (body)
• Headers and additional parameters like the Sender E-mail address
Syntax:
Code:
mail( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )
Code:
<?php
//Check whether the submission is made
if(isset()){ //Declarate the necessary variables
=;
=;
=;
=; //Check for success/failure of delivery
if(mail(,,,"From:/r/nReply-to:"))
echo "<span class='red'>E-mail has been sent successfully from to </span>";
else
echo "<span class='red'>Failed to send the E-mail from to </span>";
}
?>
Bookmarks