Tutorial :Sending a reply mail using PHP



Question:

I am sending a reply mail using PHP to those who send a mail to me.

My problem is when I send an email, it sits in the spam folder. What do I do in order to deliver mail correctly. What should I do?

My code

<?php      $email_id="welcome@gmail.com";      $recipient = "@gmail.com"; //Recipient      $mail_body = $message; //Mail body      $subject = "Subject ".$Name.""; //Subject      $header = "From: ". $Name . " <" . $email . ">\r\n"; //Optional headerfields      $header .='Content-type: text/plain; charset=utf-8'."\r\n";      mail($recipient, $subject, $mail_body, $header); /mail command :)  ?>  


Solution:1

The problem is not necessarily in your code. One possibility is that your server's mail transfer agent is misconfigured - I've experienced this issue once. Worth checking.


Solution:2

Make sure you're populating the From, Reply-To, Sender, Return-Path, and Errors-To headers with the sending e-mail address. There are so many reasons e-mails may be filtered as spam, though - your ISP may be blocked, the contents of the message may contain things that get it flagged, etc.


Solution:3

The problem is not coming from your code. You may need to configure your service. In order to be accepted by most of the email service providers, you should setup a DomainKey or a Sender Id.

You should also make sure that your IP address is not blacklisted if you are running this code on a dedicated server.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »