0

I want to send mail with smtp mail method using PHP.Now mail go to spam instead of inbox,i am using smtp mail method.I had set the hostname,username and password.

  <?php

  define("SMTP_HOST", "mail.test.net"); //Hostname of the mail server
  define("SMTP_PORT", "25"); //Port of the SMTP like to be 25, 80, 465 or 587
  define("SMTP_UNAME", "tttt"); 
  //Username for SMTP authentication any valid   email created in your domain
  define("SMTP_PWORD", "tttt"); //Password for SMTP authentication
  ?>

   //smtp mail
  $mail   = new PHPMailer;
  $mail->Host = SMTP_HOST; 
  $mail->Port = SMTP_PORT; 
  $mail->SMTPAuth = true; 
  $mail->Username = SMTP_UNAME; 
  $mail->Password = SMTP_PWORD; 
  $mail->AddReplyTo("test@test.com", "zamisoft"); 
  $mail->SetFrom("test@test.com", "zamisoft.com"); 
  $mail->Subject = $subject; 
  $mail->AddAddress($to, '');
  $mail->MsgHTML($message);
  $send = $mail->Send(); 
  $mail->ClearAddresses();

  //smtp mail

Anybody give any solution for these issue?

user3422573
  • 9
  • 1
  • 6
  • 1
    check http://stackoverflow.com/questions/20416866/php-mail-goes-in-spam-and-inbox and http://stackoverflow.com/questions/18229279/sending-email-via-php-mail-function-goes-to-spam – Pratik Joshi May 07 '15 at 04:10
  • check this too http://www.velvetblues.com/web-development-blog/avoid-spam-filters-with-php-mail-emails/ – Pratik Joshi May 07 '15 at 04:12

1 Answers1

0

There is a very similar question here regarding using PHPMailer and Spam - https://stackoverflow.com/a/16717647/1676190

This does sound more like a configuration issue with your mail server and/or your DNS server. Your mail server does not appear to be "trusted" enough, so you don't get enough "positive" points from GMail (and mail clients). I notice that you're using postfix as your mailer... Have you configured it properly?

I would suggest you configure postfix first. For example, here's a guide on how to do it in CentOS:

http://wiki.centos.org/HowTos/postfix

Second, you should add an SPF record to your DNS server:

http://en.wikipedia.org/wiki/Sender_Policy_Framework

Third, it would be good to have a reverse lookup entry for your server:

http://en.wikipedia.org/wiki/Reverse_DNS_lookup

You will need to do the above and some more to make sure that clients don't flag your mail as spam, and you don't get blacklisted

Here's a good list of things to do to avoid getting blacklisted:

http://www.supportsages.com/blog/2010/07/prevent-your-mailip-from-getting-marked-as-spamblacklisted-a-few-tips/

Community
  • 1
  • 1
Josh
  • 847
  • 9
  • 17