Solved

avoiding php emails going to spam or junk

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

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

758 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

23 Experts available now in Live!

Get 1:1 Help Now