Solved

avoiding php emails going to spam or junk

Posted on 2010-09-09
2
883 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

623 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