Solved

avoiding php emails going to spam or junk

Posted on 2010-09-09
2
867 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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…
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.

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now