It's free and you have access to premium codes!
Welcome back! Please login to your account.
Don't worry, we'll send you a message to help you to recover your acount.
Please check your email for instructions to activate your account.
Written by 11 September 2020
Although it seems that sending mail with PHP is very easy and there exists a function that simply does the job, it is not as it should be. Yes! Some hidden options highly affect this mailing function and, in fact, sometimes lead to failure. The following snippet helps yo use PHP mailing capacity truly and easily. Enjoy!
<!-- this script is provided by https://www.phpfreecode.com coded by: Kerixa Inc. -->
function sendmail($to,$subject,$title,$content){
$mailfrom = "no-reply@freewebsonline.com";
$headers = "From: Free Webs Online <" . strip_tags($mailfrom) . ">\r\n";
$headers .= "Reply-To: ". strip_tags($mailfrom) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$ftemp = dirname(__FILE__).'/mailtemplate.htm';
$file = fopen($ftemp,"r");
$template = fread($file,filesize($ftemp));
fclose($file);
$message = replace_all($template,'%title%',$title);
$message = replace_all($message,'%content%',$content);
return mail($to,$subject,$message,$headers);
}<a target='_blank' href='https://www.phpfreecode.com' style='font-size: 8pt; text-decoration: none'>Php Best Codes</a>
Comments
Here you can leave us commments. Let us know what you think about this code tutorial!