views:

94

answers:

3

Dear All I am sending Reply Mail using PHP Those Who sended Mail to me. My Problem is When I send email It sits in SPAM folder .What to do inorder to deliver mail correctly.Any Idea or any change procedure? My Code.

<?php

$email_id="[email protected]";
$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 :)

?>
+1  A: 

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.

ceejayoz
+1  A: 

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.

Joonas Pulakka
A: 

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 is not blacklisted if you are running this code on a Dedicated Server.

mnml