Previously I have posted PHP email scripts here but here is an update that is working for me now. There is one common problem with the email that is sent by using PHP scripts. That is: Email land in junk or spam folder. Here is the solution with HTML ready email. Send PHP email with correct headers info, in HTML format that will not land in receiver’s junk folder or spam folder.
The problem seems to be with the From header. Use correct headers like below and you email will not be marked with spam.
<?php // $mailto=$txtEmail; // or $mailto="email@example.com"; $mailfrom="firstname.lastname@example.org"; $mailfrom2="myName <email@example.com>"; $subject= "Subject of email"; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: ".$mailfrom2."\r\n"; $headers .= "Reply-To: ".$mailfrom."\r\n"; $headers .= "Return-Path: ".$mailfrom."\r\n"; $headers .= "Signed-by: sitename.com"; // $headers .= 'Cc: firstname.lastname@example.org' . "\r\n"; // $headers .= 'Bcc: email@example.com' . "\r\n"; $mmessage = " <br /><br /> Hello <strong>Buddy</strong> <br /><br /> Thanks for joining my website. <br /><br /> More text and html code... <br /><br /> Your brand name <br /> <a href='https://www.mysite.com'>https://www.mysite.com</a> "; @mail($mailto, $subject, $mmessage, $headers); ?>