Sending Emails in PHP Example
Tuesday, August 10th, 2010With the help of smartwebby.com, we are able to show you the basic example when sending an email in PHP.
Syntax: mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )
Ex:
Sample PHP Code:
<?php
//Check whether the submission is made
if(isset($hidSubmit)){//Declarate the necessary variables
$mail_to=$txtEmailto;
$mail_from=$txtEmailfrm;
$mail_sub=$txtSub;
$mail_mesg=$txtMsg;//Check for success/failure of delivery
if(mail($mail_to,$mail_sub,$mail_mesg,”From:$mail_from/r/nReply-to:$mail_from”))
echo “<span class=’red’>E-mail has been sent successfully from $mail_sub to $mail_to</span>”;
else
echo “<span class=’red’>Failed to send the E-mail from $mail_sub to $mail_to</span>”;
}
?>








Smarty is categorized as a “Template engine”, though developers describe it more detailed as a “Template/Presentation Framework”, that offers developers and programmers ample tools to make extensive coding tasks easier by replacing tags with their appropriate counterparts. Smarty is aimed to hasten and make the development process simpler for all who aim to develop pages for the internet.