Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

avoiding php emails going to spam or junk

Posted on 2010-09-09
2
Medium Priority
?
889 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 84

Accepted Solution

by:
Dave Baldwin earned 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When you’re making plans to join the modern business race, you should analyze various details that may affect your results. Nowadays, millions of businesses are trying to grow into established and appreciated professional enterprises.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
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.

661 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