1

hi friends i am using php mail function to deliver my mail to my group member, i am using smtp server but my mails are delivered in the spam folder instead of the inbox i did not create any spam filter in my mail id please guide how to solve this issue

$email = GetUserEmailID(GetUserIdfromNews($newsvl[$k]));
$username = GetUserAdminName(GetUserIdfromNews($newsvl[$k]));
$headers  = "MIME-Version: 1.0\r";
$headers .= "Content-type: text/html; charset=iso-8859-1\r";
$headers .= "From: <$fromemail>";
$subject  = "Posted News has been Approved by Administrator";

$msg ="Hello <font color='#0000FF'>".ucfirst($username)."</font>\n\n<br><br>";
$msg.="************************************************\n<br>";
$msg.="Congrats, Your Last Posted News has been Approved by Administrator\n<br>";
$msg.="************************************************\n<br>";
// echo $msg." ".$subject." ".$email.
// " ".GetUserIdfromNews($newsvl[$k])." ".$newsvl[$k];
mail($email, $subject, $msg, $headers);
ajreal
  • 46,720
  • 11
  • 89
  • 119
Meena
  • 957
  • 5
  • 19
  • 35
  • Well you are sending HTML rather than plain text... – ChrisF Nov 26 '10 at 13:03
  • think your sender id is not recognized as valid user by your mail admin / exchange server – JoseK Nov 26 '10 at 13:04
  • 2
    If you are sendind the mail from an smtp server other than the server of <$fromemail>, the mail will be delivered as spam. – Carlos Melo Nov 26 '10 at 13:04
  • 2
    In order to know why you message is being flagged as spam, you usually must look at the message headers (message source) from the receiver. There are a few things that affect that: SPF, RBLs, scoring, etc. and they change depending on the receiver's domain. – netcoder Nov 26 '10 at 13:08
  • My from id is xx@yahoo.com it is valid id – Meena Nov 26 '10 at 13:19
  • is there is any good link to know about the SPF, RBLs, scoring, etc bcoz i am facing this issue past 2 month .if you give your suggesstion means its a timely help for me – Meena Nov 26 '10 at 13:20
  • possible duplicate of [php mail function: legitimate mails marked as spam by gmail and hotmail](http://stackoverflow.com/questions/3845551/php-mail-function-legitimate-mails-marked-as-spam-by-gmail-and-hotmail) – Pekka Nov 26 '10 at 13:25

2 Answers2

0

My from id is xx@yahoo.com it is valid id

this is indeed the first problem: The sender address you use should be running on the domain you send the E-Mail from.

For other common reasons for this, see the duplicate link.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
0

Have you tried to figure out how was your mail being sent? mail() is simply a built-in function that deliver mail to the local SMA (e.g. sendmail), from that point on it's depend on your machine's configuration.

Most likely, as Pekka suggests, is that the recipient had determined that the SMTP server you are sending from is untrustworthy to send a mail claim to be from.

If you have no control over your php environment, consider using function from libraries that utilize servers from free but well-known e-mail providers, e.g. GMail's SMTP-TLS server. You have to write my-php-app@gmail.com (whatever account you are using) in the Form field, however you may assign an Reply-To to reveal the actual e-mail that is monitored.

timdream
  • 5,914
  • 5
  • 21
  • 24