0

Below is header to sent to user:

$to="$mail";
$sub="Thank you!";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type:text/html; charset=iso-8859-1\r\n";
$headers .= 'From: example.com <noreply@example.com>' . "\r\n";
$msg="Dear $nme ,<br/> We received a request to recover your password.<br/> Your Password is $pss .";


$response =@mail($to,$sub,$msg,$headers);

If i send it through diff sever it goes to inbox. How can I prevent email going to spam?

gss
  • 63
  • 1
  • 2
  • 11

2 Answers2

1

I think generally, a mail is termed as spam or not spam on the receiving end of it, not the sending end - or else any spammers would simply say that all of their messages are not spam, completely defeating the purpose. Thus, you can't just force a message to go to a sender's inbox.

However, what you may need to do is see if the machine that you're using to send mail is currently listed on any spam blocklists, and if so, take the necessary steps to remove it from those blocklists.

chandresh_cool
  • 11,753
  • 3
  • 30
  • 45
1
$to='example@gmail.com';
$subject='Application Form ';
$message='testing';

 $headers  = 'MIME-Version: 1.0' . "\r\n";
 $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 $headers .= 'From: admin <admin@gmail.com>' . "\r\n";
 if(mail($to,$subject,$message,$headers))
 {
  echo "Mail Successfully Sent..";
  exit;
 }

It works perfectly to me. You can also use SMTP MAIL instead of this.

Debashis
  • 566
  • 2
  • 14
  • 34
monojit
  • 605
  • 5
  • 19