Question

I am using simple PHP mail function to send mail. Here is my code:

sendEmail('xyz@gmail.com', 'test subject', 'test body', 'xyz name', 'abc@gmail.com', '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 no-reply@xyz.com');
    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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top