I am using simple PHP mail function to send mail. Here is my code:
sendEmail('[email protected]', 'test subject', 'test body', 'xyz name', '[email protected]', 'HTML');
function sendEmail($to, $subject, $body, $fromName, $from, $format = '')
{
$headers = '';
if($format=='HTML')
{
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
}
$headers .= "From: $fromName <$from>" . "\n";
$success = mail($to, $subject, $body, $headers, '-f [email protected]');
return $success;
}
My problem is this when i send more than one (like 10) mail then some mail goes into spam and some in inbox. If script is wrong then all mail should go into spam or if right then all mail into inbox.
Why some mail goes into spam and some in inbox?
while subject, body, message and email(to) is same.
Use full headers to avoid spam
http://www.velvetblues.com/web-development-blog/avoid-spam-filters-with-php-mail-emails/
Prevent sent emails treated as junk mails using php mail function