How to Avoid Spam Filters with PHP mail() Emails

4 ways to make your PHP mail () Less Spammy Emails


1. Use Headers

In the simple example above, the name and email address was added as the fourth parameter. Instead, consider using headers to set the From and Reply-To email addresses.

<? 

$headers .= "Reply-To: The Sender <sender@sender.com>\r\n"; 

$headers .= "Return-Path: The Sender <sender@sender.com>\r\n"; 

$headers .= "From: The Sender <senter@sender.com>\r\n"; 

?>

But headlines are good for more than just set the details on the sender. Also important to set the content type, priority mail, and more. Here are how some additional headers look.



<? 

$headers .= "Organization: Sender Organization\r\n";

$headers .= "MIME-Version: 1.0\r\n";

$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";

$headers .= "X-Priority: 3\r\n";

$headers .= "X-Mailer: PHP". phpversion() ."\r\n" 

?>

Be sure to replace the fourth parameter of the variable $ headers as shown below.



<? 

mail("recipient@recipient.com", "Message", "A simple message.", $headers); 

?>

2. Message sender domain and server domain must match


Spammers send email from a server and the recipient to believe that it came from somewhere else are notorious for. So if you are sending an email to example@example.com, it is a good idea to keep at example.com script.

3. Be sure to use the content-type attribute


The content-type attribute allows a sender of the message to say whether or not an email is plain text or HTML, or have attachments. Obviously, the easiest to use the content type is text / plain. You simply add the text as shown in the example simple, and that's it. However, when using content types, additional parts you would expect. For example, with the content type text / html, HTML body tag is expected. Not having this label may result in an email being marked as spam.

4. Verify that your server is not blacklisted



When a server is blacklisted, which means that the server has been identified as one who has been sending a lot of spam. This results in the recipient's mail servers reject or filter all mail that is received from that server. So if your mail is received is not a good idea to check that the server has been blacklisted. This goes for both shared and dedicated servers. In a shared environment, it is common for other users on the server to send spam. And in a dedicated environment, spammers may have found a way to exploit a vulnerability in a server or a contact form to send spam. Making it easy for any type of server blacklisted.

Well, now that you have the basics on how to avoid spam filters, rebuild scripts and email happy!

Post a Comment

1 Comments

  1. Spread the word - link to us ... There are two sides to preventing spam: ... To stop receiving spam it helps to know what kind of spam you are getting. emails

    ReplyDelete

Thank you for your comment.. We will contact you soon..

Emoji
(y)
:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
x-)
(k)

Close Menu