Solved

avoiding php emails going to spam or junk

Posted on 2010-09-09
2
874 Views
Last Modified: 2012-06-21
Hi experts,

We are having trouble with our emails being junked by gmail, hotmail etc when we send our users messages from a php mail() call.  I have attached a basic outline of our emails... is there anything which might be jeapordising us, like the header info?  And are there any definitie rules to help avoid our mails being junked?

Thanks.
$theboundary = md5(uniqid(""));
$fromname="users email";
$fromemail="users email";
$subject="subject";

$header = "From: \"$fromname\" <$fromemail>";
$header .= "\nMIME-Version: 1.0";
$header .= "\nContent-Type: multipart/alternative;";
$header .= "\n        boundary=\"----=_NextPart_$theboundary\"";
$header .= "\nX-Priority: 3";
$header .= "\nX-MSMail-Priority: Normal";

$htmlmessage = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional //EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>our email</title>


<body>


some images and text
  
  
</body>
</html>';
$textmessage = 'some text';

$body = "This is a multi-part message in MIME format.\n\n";
$body = "------=_NextPart_$theboundary\nContent-Type: text/plain;\n\n";
$body .= $textmessage;
$body .= "\n------=_NextPart_$theboundary\nContent-Type: text/html;\n\n";
$body .= $htmlmessage;
$body .= "\n\n";

mail($email_list[$mail_no], $subject, $body, $header);

Open in new window

0
Comment
Question by:RowdyBurns
2 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 33642088
Are you sending your emails from a known and checkable email address?  
The first and second lines of your DOCTYPE are mismatched.  And there was no </head> in your sample though you have just left that out.

If this is bulk email, services like Constant Contact, iContact, and Aweber do this very well... since it is their business and they spend all day doing it.  See if you have any emails from them and look at the header formats and data they use.
$htmlmessage = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional //EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>our email</title>
</head>

Open in new window

0
 
LVL 7

Assisted Solution

by:Vimal DM
Vimal DM earned 250 total points
ID: 33643445
Hai,

I suggest you to use "PHPMAILER",

1) Can avoid spams
2) Bulk mailing
3) File attachment.
4) Then which supports all the email ids

All enough to do is,download the PHPMAILER class file and know to make use the functions available there.


Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What is Usenet? There are many different opinions on exactly what Usenet is an isn't. Many opinions are incorrect simply out of ignorance. The Wikipedia listing about Usenet does a good job of explaining it, so instead of repeating it all here I wi…
There was an incident about the POP3 issue for the double read receipts and delivery receipts in Exchange 2013.  There was huge research been done and found solution for the duplicate mails. Especially when the user gets  duplicate mails.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question