How do you make an email go to spam - php

I am writing a script for a film. I have a basic script that sends an HTML email to two sets of emails. On the form you enter in the event information and that information gets sent to two lists of users, the "Desired Guests" and the "Undesired Guests" they both get the same exact HTML email however I need the email for the "Undesired Guests" to go to the spam folder. So what I did was for the "Undesired Guest" email list was insert a bunch of spam content into the body of the email as I need this email to send to the spam folder. The "Desired Guests" email should go to the inbox just fine (as is currently is)
Is there any way I can make the "Undesired Guests" email to go spam for sure? Can I send the email through an outside server with a different IP and bad reputation to make these emails go to spam?
Any input would be a great help.
<?php
if(isset($_POST['submit'])) {
$event = strtoupper($_POST['event']);
$host = strtoupper($_POST['host']);
$location = strtoupper($_POST['location']);
$date = $_POST['date'];
$start_time = $_POST['start_time'];
$end_time = $_POST['end_time'];
$msg = ucfirst($_POST['msg']);
$mainuser = $_POST['mainuser'];
$wrong_user = $_POST['wrong_user'];
if($mainuser!='') {
$user_mail = explode(",", $mainuser);
$count = count($user_mail);
$sub = "You're Invited";
$sender = "info#cdell.me";
for($i=0;$i<$count;$i++){
$mail_to = $user_mail[$i];
$mail_body =
'<style type="text/css">
<!--
.style1 {color: #8f8f8f}
-->
</style>
</head>
<body style="font-family:Arial, Helvetica, sans-serif; background:#f5f5f5; line- height:24px;">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
<tr>
<td><img src="http://www.cdell.me/invite-site/header.png" width="600" height="200" /></td>
</tr>
<tr>
<td height="50" bgcolor="#ececec"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#e0e0e0" style="padding:20px; font-size:16px; color:#8f8f8f" align="center">
<p><strong>'.$event.'</strong></p>
<p><strong>When:</strong> '.$date.' '.$start_time.' - '.$end_time.'</p>
<p><strong>Where:</strong> '.$location.'</p>
<p><strong>Message From '.$host.':</strong> <br /> '.$msg.'</p><br /><br /></td>
</tr>
<tr>
<td bgcolor="#e0e0e0" align="center">RSVP!</td>
</tr>
<tr>
<td height="30" bgcolor="#e0e0e0"> </td>
</tr>
<tr>
<td height="40"> </td>
</tr>
<tr>
<td><table width="520" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="5" style="border-bottom:solid 1px #2ecc71"> </td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><table width="600" border="0" cellpadding="0" cellspacing="0" bgcolor="#2ecc71">
<tr>
<td width="40"> </td>
<td width="240"> </td>
<td width="40"> </td>
<td width="240"> </td>
<td width="40"> </td>
</tr>
<td width="40"> </td>
<td width="240"> </td>
<td width="40"> </td>
<td width="240"> </td>
<td width="40"> </td>
</tr>
</table></td>
</tr>
</table>
</body>';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= "to:".$ro['emai_addrs']."\r\n";
$headers .= "from: ".$sender."\r\n";
mail($mail_to, $sub, $mail_body, $headers);
//echo $mail_body;
}
}
if($wrong_user!='') {
$user_mail=explode(",", $wrong_user);
$count=count($user_mail);
$sub="INVITATION";
$sender="";
for($i=0;$i<$count;$i++) {
$mail_to = $user_mail[$i];
$mail_body =
'<style type="text/css">
<!--
.style1 {color: #8f8f8f}
-->
</style>
</head>
<body style="font-family:Arial, Helvetica, sans-serif; background:#f5f5f5; line-height:24px;">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
<tr>
<td><img src="http://www.cdell.me/invite-site/header.png" width="600" height="200" /></td>
</tr>
<tr>
<td height="50" bgcolor="#ececec"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#e0e0e0" style="padding:20px; font-size:16px; color:#8f8f8f" align="center">
<p><strong>'.$event.'</strong></p>
<p><strong>When:</strong> '.$date.' '.$start_time.' - '.$end_time.'</p>
<p><strong>Where:</strong> '.$location.'</p>
<p><strong>Message From '.$host.':</strong> <br /> '.$msg.'</p><br /><br /></td>
</tr>
<tr>
<td bgcolor="#e0e0e0" align="center">RSVP!</td>
</tr>
<tr>
<td height="30" bgcolor="#e0e0e0"> </td>
</tr>
<tr>
<td height="40" style="color:white;"> 9 INCH PENIS, SPAM EMAIL, THIS IS SPAM, 10 INCH PENIS, VIAGRA, PENIS ENLARGMENT, NIGERAIAN $$$100,000,000.00, FREE CREDIT REPORT, FREE 10 INCH PENIS ENLARGER, CLICK HERE FOR FREE VIAGRA WIN A FREE CAR!!! WORTH 10K$$$, NO CREDIT CHECK PAYDAY LOANS, CAR LOANS, INHERIT $10,675,981.98 US CURRENCY FROM NIGERIAN PRINCE US BANK ACCOUNT NEEDED</td>
</tr>
<tr>
<td><table width="520" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="5" style="border-bottom:solid 1px #2ecc71"> </td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td style="color:23cc71;"><table width="600" border="0" cellpadding="0" cellspacing="0" bgcolor="#2ecc71" style="color:23cc71;">
<tr>
<td bgcolor="#2ecc71" style=" color:#2ecc71;" align="center">
9 INCH PENIS, SPAM EMAIL, THIS IS SPAM, 10 INCH PENIS, VIAGRA, PENIS ENLARGMENT, NIGERAIAN $$$100,000,000.00, FREE CREDIT REPORT, FREE 10 INCH PENIS ENLARGER, CLICK HERE FOR FREE VIAGRA</td>
<td width="240" bgcolor="#2ecc71" style=" color:#2ecc71;" align="center"> WIN A FREE CAR!!! WORTH 10K$$$, NO CREDIT CHECK PAYDAY LOANS, CAR LOANS, INHERIT $10,675,981.98 US CURRENCY FROM NIGERIAN PRINCE US BANK ACCOUNT NEEDED</td>
<td width="40" bgcolor="#2ecc71" style=" color:#2ecc71;" align="center"> </td>
<td width="240" bgcolor="#2ecc71" style=" color:#2ecc71;" align="center"> </td>
<td width="40" bgcolor="#2ecc71" style=" color:#2ecc71;" align="center"> </td>
</tr>
<td width="40" bgcolor="#2ecc71" style=" color:#2ecc71;" align="center"> 9 INCH PENIS, SPAM EMAIL, THIS IS SPAM, 10 INCH PENIS, VIAGRA, PENIS ENLARGMENT, NIGERAIAN $$$100,000,000.00, FREE CREDIT REPORT, FREE 10 INCH PENIS ENLARGER, CLICK HERE FOR FREE VIAGRA</td>
<td width="240" bgcolor="#2ecc71" style=" color:#2ecc71;" align="center"> </td>
<td width="40" bgcolor="#2ecc71" style=" color:#2ecc71;" align="center"> </td>
<td width="240" bgcolor="#2ecc71" style=" color:#2ecc71;" align="center"> 9 INCH PENIS, SPAM EMAIL, THIS IS SPAM, 10 INCH PENIS, VIAGRA, PENIS ENLARGMENT, NIGERAIAN $$$100,000,000.00, FREE CREDIT REPORT, FREE 10 INCH PENIS ENLARGER, CLICK HERE FOR FREE VIAGRA</td>
<td width="40" bgcolor="#2ecc71" style=" color:#2ecc71;" align="center">
<!-- Spam Pixel Images -->
<img src="http://www.cdell.me/invite-site/green-pixel1.png" />
<img src="http://www.cdell.me/invite-site/green-pixel2.png" />
<img src="http://www.cdell.me/invite-site/green-pixel3.png" />
<img src="http://www.cdell.me/invite-site/green-pixel4.png" />
<img src="http://www.cdell.me/invite-site/green-pixel5.png" />
<img src="http://www.cdell.me/invite-site/green-pixel6.png" />
<img src="http://www.cdell.me/invite-site/green-pixel7.png" />
<img src="http://www.cdell.me/invite-site/green-pixel8.png" />
<img src="http://www.cdell.me/invite-site/green-pixel9.png" />
<img src="http://www.cdell.me/invite-site/green-pixel10.png" />
<img src="http://www.cdell.me/invite-site/green-pixel11.png" />
<img src="http://www.cdell.me/invite-site/green-pixel12.png" />
<img src="http://www.cdell.me/invite-site/green-pixel13.png" />
<img src="http://www.cdell.me/invite-site/green-pixel14.png" />
<img src="http://www.cdell.me/invite-site/green-pixel15.png" />
<img src="http://www.cdell.me/invite-site/green-pixel16.png" />
<img src="http://www.cdell.me/invite-site/green-pixel17.png" />
<img src="http://www.cdell.me/invite-site/green-pixel18.png" />
<img src="http://www.cdell.me/invite-site/green-pixel19.png" />
<img src="http://www.cdell.me/invite-site/green-pixel20.png" />
</td>
</tr>
</table></td>
</tr>
</table>
</body>';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html;" . "\r\n";
$headers .= "to:".$ro['emai_addrs']."\r\n";
$headers .= "from: ".$sender."\r\n";
mail($mail_to, $sub, $mail_body, $headers);
//echo $mail_body;
}
}
$var = "Invitation Sent Successfully";
}

Have you tried adding X-Spam related headers, so as to masquerade as something that went through and got caught by Spam Assassin?
If not, a few headers you might want to look into:
X-Spam-Score
X-Spam-Level
X-Spam-Status
X-Spam-Flag
X-Spam-Report
More info:
https://www.lamphost.com/Knowledge_Base/What_headers_are_added_to_emails_that_are_scanned_by_SpamAssassintm

There are plenty of things you can do to get it marked as spam, however, if someone has you listed as a 'safe-sender', 100% guarantees may be out of the question.
There are plenty of keywords you can use, they don't need to be shady words either. In the past, I've had issues just using large money amounts, exclamation points and the word 'free'.
Litmus is a great tool for checking your spam scores in different mail clients. For most spam software, it is an accumulative score, so you will easily be able to identify the worst (or in your case best) culprets.

Just BLACKLIST your Ip address,
also each blacklisting servers has their own listing criteria that may include technical listings, policy listings, and evidence based listings. Technical listings are those that occur mostly from mail server configuration issues such as missing or incorrect reverse DNS records, missing on incorrect banner greetings, and mail servers operating in IP address space that an ISP has specified that mail servers should not be operating in. Policy listings are those based on an operator that does not wish to receive email from certain countries, or ISPs, or has a history of no honoring unsubscribe requests. Evidence based listings are those where the operator has receive direct (or indirect) evidence that an IP address has been involved in sending unsolicited emails.

Related

Is it possible to create html elements for email templates via a loop?

I have a working phpMailer that sends out various email templates; emails for "forgot password" or "forgot username", etc.
I was curious if it was possible to create html elements via a while loop? (I'm sorry I can't explain it so well, so here is my current code. It works but it just doesn't do the loop that I want it to do. It sends an email with just one username).
for ($i=0; $i < count($w_user_id_infos); $i++) {
$replaceUsername = $w_user_id_infos[$i]["login_cd"];;
for ($j=0; $j < count($w_user_id_infos[$i]["customer_info"]); $j++) {
$w_customer_name1_text = $w_user_id_infos[$i]["customer_info"][$j]["customer_name1_text"];
$w_customer_name2_text = $w_user_id_infos[$i]["customer_info"][$j]["customer_name2_text"];
$w_body .= ($j + 1) . " " . $w_customer_name1_text . " / " . $w_customer_name2_text . "<br>";
$replacementValues = [
$w_customer_name1_text,
$w_customer_name2_text
];
$templateValues = [
"%username%",
"%company%",
"%company2%"
];
}
array_splice($replacementValues, 0, 0, $replaceUsername);
$w_body = file_get_contents('../../../framework/src/function/html_templates/forgot_username.html');
$w_body = str_replace($templateValues, $replacementValues, $w_body);
}
$data = explode(',', $_SESSION['icon_data']);
$image_data = base64_decode($data[1]);
f_common_send_mail($w_addr, $w_subject, $w_body, $image_data);
So, for our program, a user can create multiple accounts with a single email address. The goal with the loop problem is, if that user forgot one (or more) of their usernames, they can click "forgot username" and after they enter their email address, an email would be sent with all of their usernames.
This is the html template.
<table bgcolor="#ffffff" class="table_content" align="center" cellpadding="0" cellspacing="0" border="0">
<!-- HEAD -->
<tr>
<td bgcolor="#ffffff" class="header_detail_area">
<table width="10%" align="left" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding: 0 20px 20px 0;">
<img src="cid:img" style="width: 65px; height: 65px; border-radius: 50%;">
</td>
</tr>
</table>
<table width="70%" align="left" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="header_info">
STRUCT - ユーザー名の確認のお知らせ
</td>
</tr>
</table>
</td>
</tr>
<!-- HEAD END -->
<!-- USER INFO -->
<tr>
<td class="user_detail_area borderbottom">
<table width="97%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="user_info">
ユーザー名の確認を受け付けました。本メールアドレスには以下のユーザー名が紐づいています。
</td>
</tr>
<tr>
<td class="user_info_blockquote">
<p class="blockquote">
<font style="color: #03abf2"> ユーザー名: </font> %username% <br>
<font style="color: #03abf2"> 所属会社: </font> %company% / %company2%
</p>
</td>
</tr>
<tr><td><br></td></tr>
</table>
</td>
</tr>
<!-- USER INFO END -->
<!-- FOOTER DETAILS -->
<tr>
<td class="footer_detail_area" bgcolor="#31424b">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<img src="cid:Logo" width="200">
</td>
</tr>
</table>
</td>
</tr>
<!-- FOOTER DETAILS END -->
</table>
</td>
</tr>
</table>
I want to know if this is possible? To somehow create more of the %username% based on the for loop?
The user currently receives the email with just the one username that is registered with their email address.
Is it possible to manipulate the html email template with a loop? My thought is that since it's using an already-made email template, it won't have the chance to add any more html elements? even if I added some string literals, I don't think I can loop inside a string literal.
Thank you in advance.
My solution:
I replaced the whole tr that needed to be looped:
<tr>
<td class="user_info_blockquote">
<p class="blockquote">
<font style="color: #03abf2"> ユーザー名: </font> %username% <br>
<font style="color: #03abf2"> 所属会社: </font> %company% / %company2%
</p>
</td>
</tr>
changed to just:
%userElement%
then I created that html element in my loop like so:
$userElement .=
'<tr>
<td class="user_info_blockquote">
<p class="blockquote">
<font style="color: #03abf2"> ユーザー名: </font> '. $replaceUsername .' <br>
<font style="color: #03abf2"> 所属会社: </font> '. $w_customer_name1_text .' / '. $w_customer_name2_text .'
</p>
</td>
</tr>';
Worked like a charm.

PHP mail send very slowly

I have a VPS with inmotion hosting, and i send a confirmation email, but the email it takes too mucho to send, how is the best way to estructure the html code when i send a mail, how can i boost the performance.
This is my code.
$subject = 'Mail activation';
$body = '
<html>
<head>
<base target="_blank">
</head>
<body>
<table style="max-width:800px; margin:0 auto; font-family: Arial, Helvetica, sans-serif;" cellspacing="0" cellpadding="10">
<thead style="border-bottom:1px solid #DDD;">
<tr>
<td align="center" style="border-bottom:1px solid #DDD;">
<img src="http://p.unid.com/img/logoSASENegro.png" alt="" height="45" width="150"/>
</td>
</tr>
</thead>
<tbody>
<tr>
<td>
Hi classmate
</td>
</tr>
<tr>
<td>
Press the following link.
</td>
</tr>
<tr>
<td>
www.google.com
</td>
</tr>
<tr>
<td>
You data:
</td>
</tr>
<tr>
<td>
ID - <b>'.$ids.'</b><br/>
Password - <b>'.$pass.'</b><br/>
</td>
</tr>
<tr>
<td>
Don't response this email.
</td>
</tr>
</tbody>
</table>
</body>
</html>
';
$headers = "MIME-Version: 1.0\r\n";
$headers .="Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: Contacto SASE <atencionsase#unid.mx>\r\n";
if(mail($emailC, $subject, $body, $headers))
On some servers mail() sent emails really slow. Your issue is not related to message content, but it related to your hosting provider. As a possible solution, you can just switch your script to sending mail via different SMTP server (for example gmail: Send email using the GMail SMTP server from a PHP page).

Outlook Receiving Mails in HTML Code

In my project i have done some email code to receive the order details, 1 mail to admin and other mail for user..
But some users and admins are receiving the emails with html code.. I checked in many ways with gmail, webmail.. All are displaying good.. Finally I tested with outlook and in outlook mail was getting in html code.. By enquiring the users they said that they r using outlook.. So that issue was with outlook I think so..
Can anyone help me to solve this issue.. Here is the source code which was used for displaying in email message.
$to = $obj_check_out->email;
$subject = "NEW YORK PRODUCT ORDER";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: Instyle Customer Accounts <vamsi#mail.com>" . "\r\n";
$message = '<table width="100%" align="center">
<tbody><tr><td bgcolor="#393939">
<br>
<br>
<table cellspacing="0" cellpadding="0" width="650" border="0" align="center">
<tbody>
<tr>
<td width="10" bgcolor="#efefef">
<img src="images/newsletter/top_left.jpg" class="CToWUd">
</td>
<td width="630" height="92" bgcolor="#efefef" background="images/newsletter/top_bg.jpg">
<table width="630">
<tbody>
<tr>
<td width="514">
<font color="#333333" style="font-family:Tahoma;font-size:12px">
<br>
<b><a target="_blank" href="#"><span class="il">NEWYORK</span>.COM</a> ORDER CONFIRMATION</b> </font>
<font color="#333333" style="font-family:Tahoma;font-size:10px">[ DATE: '.$response["date_ordered"].' ]</font>
</td>
<td width="104" align="right">
<font color="#333333" style="font-family:Tahoma;font-size:12px">
<br>
<b>ORDER#:</b></font>
<font color="#333333" style="font-family:Tahoma;font-size:10px"> '.$response["order_log_id"].'</font>
</td>
</tr>
</tbody>
</table>
<br>
</td>
<td width="10" bgcolor="#efefef">
<img src="images/newsletter/top_right.jpg" class="CToWUd">
</td>
</tr>
<tr>
<td bgcolor="#efefef"> </td>
<td bgcolor="#efefef">
<font color="#333333">
<table cellspacing="0" cellpadding="2" width="630" border="0">
<tbody>
<tr>
<td height="35" bgcolor="#767676" background="images/newsletter/bar_bg.jpg" colspan="2">
<font color="#ffffff" style="font-family:Tahoma;font-size:12px">
<b>SHIPPING DETAILS</b></font>
</td>
</tr>
<tr>
<td width="170"> <font style="font-family:Tahoma;font-size:10px"><b>Name :</b></font></td>
<td width="452"><font style="font-family:Tahoma;font-size:10px">'.$response["firstname"].' '.$response["lastname"].'</font></td>
</tr>
<tr>
<td> <font style="font-family:Tahoma;font-size:10px"><b>Address :</b></font></td>
<td><font style="font-family:Tahoma;font-size:10px">'.$response["ship_address1"].' '.$response["ship_address2"].'</font></td>
</tr>
<tr>
<td> <font style="font-family:Tahoma;font-size:10px"><b>City :</b></font></td>
<td><font style="font-family:Tahoma;font-size:10px">'.$response["ship_city"].'</font></td>
</tr>
<tr>
<td> <font style="font-family:Tahoma;font-size:10px"><b>State :</b></font></td>
<td><font style="font-family:Tahoma;font-size:10px">'.$response["ship_state"].'</font></td>
</tr>
<tr>
<td> <font style="font-family:Tahoma;font-size:10px"><b>Country :</b></font></td>
<td><font style="font-family:Tahoma;font-size:10px">'.$response["ship_country"].'</font></td>
</tr>
<tr>
<td> <font style="font-family:Tahoma;font-size:10px"><b>Zip :</b></font></td>
<td><font style="font-family:Tahoma;font-size:10px">'.$response["ship_zipcode"].'</font></td>
</tr>
<tr>
<td> <font style="font-family:Tahoma;font-size:10px"><b>Phone :</b></font></td>
<td><font style="font-family:Tahoma;font-size:10px">'.$response["telephone"].'</font></td>
</tr>
<tr>
<td> <font style="font-family:Tahoma;font-size:10px"><b>Email :</b></font></td>
<td><font style="font-family:Tahoma;font-size:10px"><a target="_blank" href="mailto:'.$response["email"].'">'.$response["email"].'</a></font></td>
</tr>
<tr>
<td> <font style="font-family:Tahoma;font-size:10px"><b>Courier :</b></font></td>
<td><font style="font-family:Tahoma;font-size:10px">'.$response["courier"].'</font></td>
</tr>
</tbody>
</table>
<br>
<table cellspacing="0" cellpadding="2" width="630" border="0">
<tbody><tr>
<td background="images/newsletter/bar_bg.jpg" align="center"><font color="#a1a1a1" style="font-family:Tahoma;font-size:11px"><b>Thumb</b></font></td>
<td background="images/newsletter/bar_bg.jpg" align="center"><font color="#a1a1a1" style="font-family:Tahoma;font-size:11px"><b>Item</b></font></td>
<td background="images/newsletter/bar_bg.jpg" align="center"><font color="#a1a1a1" style="font-family:Tahoma;font-size:11px"><b>Style Number</b></font></td>
<td background="images/newsletter/bar_bg.jpg" align="center"><font color="#a1a1a1" style="font-family:Tahoma;font-size:11px"><b>Size</b></font></td>
<td background="images/newsletter/bar_bg.jpg" align="center"><font color="#a1a1a1" style="font-family:Tahoma;font-size:11px"><b>Color</b></font></td>
<td background="images/newsletter/bar_bg.jpg" align="center"><font color="#a1a1a1" style="font-family:Tahoma;font-size:11px"><b>Quantity</b></font></td>
<td background="images/newsletter/bar_bg.jpg" align="center"><font color="#a1a1a1" style="font-family:Tahoma;font-size:11px"><b>Price</b></font></td>
<td background="images/newsletter/bar_bg.jpg" align="center"><font color="#a1a1a1" style="font-family:Tahoma;font-size:11px"><b>Subtotal</b></font></td>
</tr>
'.$ordermsg.'
<tr>
<td align="right" colspan="7"><font style="font-family:Tahoma;font-size:12px">Grand-Total : </font></td>
<td align="right"><font style="font-family:Tahoma;font-size:12px">$'.$grandtotal.'</font></td>
</tr>
<tr>
<td align="right" colspan="7"><font style="font-family:Tahoma;font-size:9px">( For countries other than United State, you will be contacted by customer service for shipping fees ) </font></td>
<td align="center"></td>
</tr>
<tr>
<td align="center" colspan="8"><font style="color:red;font-family:Tahoma;font-size:9px"><br><br>* NOTE: Your order was received and will ship according to the availability notice on product page. </font><br></td>
</tr>
</tbody></table>
<table width="630" align="center" style="border-top:1px solid black">
<tbody><tr>
<td width="630" align="center">
<font color="#333333" style="font-family:Tahoma;font-size:10px">
<span class="il">Instyle</span> <span class="il">New</span> <span class="il">York</span>
230 West 38th Street
<span class="il">New</span> <span class="il">York</span>, NY 10018
PHONE: 212-840-0846 ext 22 EMAIL <a target="_blank" href="mailto:vamsi#gmail.com">info#<span class="il">company</span>.com</a>
</font>
</td>
</tr>
<tr>
<td width="630" align="center">
<font color="#333333" style="font-family:Tahoma;font-size:10px">
Purchaser agrees to abide by the <a target="_blank" href="#"><span class="il">company</span>.com</a> return policy.
</font>
</td>
</tr>
</tbody></table>
</font>
</td>
<td bgcolor="#efefef"> </td>
</tr>
<tr>
<td><img src="images/newsletter/bottom_left.jpg" class="CToWUd"></td>
<td><img src="images/newsletter/bottom_bg.jpg" class="CToWUd"></td>
<td><img src="images/newsletter/bottom_right.jpg" class="CToWUd"></td>
</tr>
</tbody>
</table>
<br><br>
</td></tr>
</tbody>
</table>';
mail($to,$subject,$message,$headers);
The email in outlook getting the same html code of $message with containing order details..
Thanks
If your code doesn't contain a valid <!doctype html> declaration and <body> tags etc, then that could contribute to the problem.
People using Outlook (or other similar mail clients) may have their settings set to not display HTML and images. I have seen that happen quite often before.
This stands at being a local issue and you have no control over that.
Therefore, you need to include a seperate header as TEXT only which is the usual norm when sending mail.
Use Phpmailer or Swiftmailer. That should solve everything.
References:
https://github.com/PHPMailer/PHPMailer
http://phpmailer.worxware.com/
http://swiftmailer.org/
and read the documentation on its implementation.
Other options are to use services such as MailChimp, Constant Contact etc. which work well and are services that are used widely and are already setup to handle both HTML and plain text formats.
http://mailchimp.com/
http://www.constantcontact.com/

Send HTML page from Form to User using PHP

I have a webpage coded in HTML that I have added a form to. What I would like is for our employees to go to the URL of the webpage, fill out the form with the customer's name, address, email and appointment date and time, then for a complete copy of the webpage and form data to be sent to the email specified in the form. Essentially, our employees will be using the webpage/form to send appointment confirmations to our clients using email. Our clients will receive the coded HTML with form data in their email, confirming their appointment times. Would like to use PHP for the server-side processing of all this.
Thanks for all your help
<html>
<head>
<title>emailConfirm-Appointment</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- Save for Web Slices (emailConfirm-Appointment.psd) -->
<table id="Table_01" width="612" height="792" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-header.jpg" alt="" width="612" height="165" border="0"></td>
</tr>
<tr>
<td colspan="5" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-title.png" alt="" width="612" height="31" border="0"></td>
</tr>
<tr>
<td height="130" colspan="3" valign="top">
<fieldset align="right">
<!-- a helper script for vaidating the form-->
<script language="JavaScript" src="scripts/gen_validatorv31.js" type="text/javascript"></script>
<form method="POST" name="contactform" action="testForm-handler.php">
<label for='name'><span style="font-size:14px">Customer:</span></label>
<input type="text" name="name"> <br>
<label for='email'><span style="font-size:14px">Email:</span></label>
<input type="text" name="email"> <br>
<label for='address'><span style="font-size:14px">Address:</span></label>
<input type="text" name="address"> <br>
<label for='city'><span style="font-size:14px">City:</span></label>
<input type="text" name="city"> <br>
<label for='date-time'><span style="font-size:14px">Date & Time:</span></label>
<input type="text" name="date-time"> <br>
<input type="submit" value="Submit"><br>
</form>
</fieldset>
<script language="JavaScript">
// Code for validating the form
// Visit http://www.javascript-coder.com/html-form/javascript-form-validation.phtml
// for details
var frmvalidator = new Validator("contactform");
frmvalidator.addValidation("name","req","Please provide your name");
frmvalidator.addValidation("email","req","Please provide your email");
frmvalidator.addValidation("email","email","Please enter a valid email address");
</script></td>
</tr>
<tr>
<td colspan="5" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-body_Walter.jpg" alt="" width="612" height="237" border="0"></td>
</tr>
<tr>
<td width="102.5" height="44" bgcolor="#FFFFFF">
<img src="images/spacer.gif" width="102.5" height="44" alt=""></td>
<td width="102.5" height="44" bgcolor="#FFFFFF">
<img src="images/spacer.gif" width="102.5" height="44" alt=""></td>
<td width="203" bgcolor="#FFFFFF">
<a href="http://www.CFProRoofing.com" target="_blank">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-buttonWebsite.png" width="203" height="44" border="0" alt=""></a></td>
<td width="102.5" height="44" bgcolor="#FFFFFF">
<img src="images/spacer.gif" width="102.5" height="44" alt=""></td>
<td width="102.5" height="44" bgcolor="#FFFFFF">
<img src="images/spacer.gif" width="102.5" height="44" alt=""></td>
</tr>
<tr>
<td colspan="5" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-signatureKalina.jpg" alt="" width="612" height="122" border="0"></td>
</tr>
<tr>
<td colspan="5" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-footer.png" alt="" width="612" height="83" border="0"></td>
</tr>
</table>
<!-- End Save for Web Slices -->
</body>
</html>
<?php
$errors = '';
$sendTo = "test#plantosellfl.com";//<-----Put Your email address here.
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['address']) ||
empty($_POST['city']) ||
empty($_POST['date-time']))
{
$errors .= "\n Error: all fields are required";
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$address = $_POST['address'];
$city = $_POST['city'];
$date_time = $_POST['date-time'];
if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*#[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}
if( empty($errors))
{
$to = $sendTo;
$email_subject = "Confirm Appointment: $address";
$email_body ='<html>
<head>
<title>emailConfirm-Appointment</title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="612px" height="792px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-header.jpg" alt="" width="612" height="165" border="0">
</td>
</tr>
<tr>
<td colspan="5" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-title.png" alt="" width="612" height="31" border="0">
</td>
</tr>
<tr>
<td height="130" colspan="3" valign="top" border="0">
<?php echo $_POST["name"]; ?><br>
<?php echo $_POST["email"]; ?><br>
<?php echo $_POST["address"]; ?><br>
<?php echo $_POST["city"]; ?><br>
<?php echo $_POST["date-time"]; ?><br>
</td>
</tr>
<tr>
<td colspan="5" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-body_Walter.jpg" alt="" width="612" height="237" border="0">
</td>
</tr>
<tr>
<td width="102.5" height="44" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/spacer.gif" width="102.5" height="44" alt="">
</td>
<td width="102.5" height="44" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/spacer.gif" width="102.5" height="44" alt="">
</td>
<td width="203" bgcolor="#FFFFFF">
<a href="http://www.CFProRoofing.com" target="_blank">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-buttonWebsite.png" width="203" height="44" border="0" alt=""></a>
</td>
<td width="102.5" height="44" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/spacer.gif" width="102.5" height="44" alt="">
</td>
<td width="102.5" height="44" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/spacer.gif" width="102.5" height="44" alt="">
</td>
</tr>
<tr>
<td colspan="5" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-signatureKalina.jpg" alt="" width="612" height="122" border="0">
</td>
</tr>
<tr>
<td colspan="5" bgcolor="#FFFFFF">
<img src="http://www.cfproroofing.com/email/images/emailConfirmAppt-footer.png" alt="" width="612" height="83" border="0">
</td>
</tr>
</table>
<!-- End Save for Web Slices -->
</body>
</html>
';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= 'From: <KaMendez#CFProRoofing.com>' . "\r\n";
$headers .= 'Reply-To: <KaMendez#CFProRoofing.com>' . "\r\n";
mail($to,$email_subject,$email_body,$headers);
}
?>
In your code, when you build the $email_body, you want to insert the $_POST variables inside it.
You don't need to put the <?php $_POST["name"] ?> tag inside it: it won't be interpreted as it is just part of the string. In fact php just suppose that you want to send a string with a less-than sign, then a question mark and so on.
If you want to put a viariable in your string try:
$email_body ='<html>
...
... html stuff ...
...
<td height="130" colspan="3" valign="top" border="0">
';
$email_body .= $_POST["name"];
$email_body .= $_POST["email"];
$email_body .= $_POST["address"];
$email_body .='</td>
...
... html stuff again ...
...
</html>';
In this way:
First you set a string with some HTML code in $email_body. And this HTML string is inside single apex-s!
Then you concatenate to it your variables (these are not inside apexs)
Then you concatenate a string of HTML again.

Converting HTML emails to "Well Formed XHTML Code"

I've trying to submit html emails to amazon's mechanical turk using the questionform xml data scheme. I'm having issues converting the html emails into well formed html data. I just input a script to grab it from my table and print the data inside the tags of the html email, but as you can see below, it's terribly formed and will not pass to mechanical turk - I've had to send the data as htmlentities() until now and this makes it difficult for HIT workers to easily solve my issues. Here's an example of how not well formed the data is - any tips on how to send this data through mechanical turk (php) or convert it to well formed html data would be appreciated.
<body text="#333333" bgcolor="#ffffff" link="#073064" vlink="#073064"
alink="#073064">
<a name="top"></a>
<table width="100%" cellspacing="0" cellpadding="10" bgcolor="#f4f2ee">
<tbody>
<tr>
<td valign="top" align="left">
<table width="600" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
<tbody>
<tr>
<td style="background-color:#e8e6dd;background-image:none;background-repeat:repeat;background-position:top left;background-attachment:scroll;font-size:10px;color:#948765;line-height:200%;font-family:verdana;" >Email not displaying correctly?
<a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/r" style="color:#948765;" >View
it in your browser.</a></td>
</tr>
<tr>
<td height="93" bgcolor="#ff6501"
background="http://i1.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/banner-tt_0.jpg">
<h1 style="font-size:30px;text-transform:lowercase;line-height:16px;color:#ffffff;font-family:Helvetica,Arial,sans-serif;text-indent:63px;margin-top:0;padding-top:29px;" >SitePoint <span
style="font-size: 17px; display: block; text-indent: 164px; color:
rgb(248, 255, 225); margin-top: 5px;">Tech Times</span></h1>
</td>
</tr>
<tr>
<td height="20" bgcolor="#C64F00" style="color:#e7fabd;font-family:arial;font-size:13px;" >
<span
id="Date" style="float:right;padding-left:5px;padding-right:5px;" ><strong>Issue 309:</strong> September 21,
2010 </span> Tips, Tricks, News and Reviews for Web Coders
</td>
</tr>
</tbody
</table>
<table width="600" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
<tbody>
<tr>
<td colspan="5" height="10"></td>
</tr>
<tr>
<td width="10"></td>
<td rowspan="2" width="380" valign="top">
<table width="100%" border="0"
style="font-family:Verdana,Arial, Helvetica, sans-serif; font-size:13px;
color:#000">
<tr>
<td>
<a name='2'></a><h2 style="font-size:20px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;" >
Introduction
</h2>
<p>
<img src="http://i2.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/lisa-lang_1.jpg" height="119"
align="left" width="130" border="0" alt="Lisa Lang" /><strong><em>Sal
</em>Tech Timers! Every week we aim to provide you with a feast of tech
geekyness -- but this issue is particularly HUGE, with goodies for
everyone. This week, I'm proud to present our latest SitePoint release <a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/y"><em>Host Your Web Site in
the Cloud</em></a><em> </em>by web evangelist Jeff Barr. Everything you
need to know about cloud computing -- and how to make it work for you --
can be found in this book. </strong>
</p>
<p>
In celebration of this release, we'll be
running a live webinar with Jeff Barr, Kevin Yank, Lucas Chan, and Louis
Simoneau. The webinar will begin at 9:00 a.m. (Australian Eastern Standard
Time) on Wednesday, 22nd September. For those in the US, the meeting starts
at 4:00 p.m. (Pacific Standard Time) on Tuesday, 21st September. Places are
limited, so hurry to register now for free here!
</p>
<p>
In the meantime, to get you in the mood for the wonderful world of cloud
computing, have a read through Toby Tremayne's latest addition to his
series "What Cloud Computing Can Mean for Your Business." Toby
shows you how to get started, and introduces a wide range of handy (and
free) applications.
</p>
<p>
Next, the other big news of the week was the release of IE9. Craig
Buckler takes a look at its interface, including some new features and
development tools of this "Beauty of the Web."
</p>
<p>
And last but not least, James Edwards has some fun with shadows for
complex shapes. He shows you how to create a fancy solution in CSS, even
managing to make it work on all modern browsers.
</p>
<p>
That should keep you busy until next week. As always, feel free to come
over and join the discussions in our forums.
</p>
<p>
Keep rocking!
</p>
<hr color="#c5b172" size="1" />
<h2 style="line-height:1.2em;" ><a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/h"
style="color:red">Over 80% of Small Businesses Use Email Marketing ... But
Only a Handful Use It Effectively</a></h2><a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/k"><img
src="http://i3.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/infusionsoft120x100-em20_2.jpg"
width="120" height="100" align="right" hspace="5" vspace="0" border="0"
/></a><p>Discover the secrets to effective, profitable email marketing
when you download the free report <em>"Email Marketing 2.0: the Three
Techniques That Will Actually Make a Difference In Your Email
Marketing."</em></p><p>Hint: this report does NOT cover subject line
suggestions, SPAM words to avoid, best time of day to send, or how to
address your contacts.</p><a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/u"
style="color:red"><strong>Don't wait -- Download your free copy
now!</strong></a><div
style="margin-bottom:2em;padding-bottom:1em;border-bottom: 1px dotted
#C5B172;"></div>
<p><strong>Summary</strong></p>
<ul style="font-size:110%;line-height:150%;" ><li>Introduction</li><li><a href="#5">What Cloud Computing Can
Mean for Your Business, Part II: Starting Your Cloud
Infrastructure</a></li><li>The IE9 Beta Review</li><li>Creating Shadows Around Polygons in CSS</li><li>New Technical Articles</li><li><a href="#12">Techy Forum
Threads</a></li><li>More Techy Blog Entries</li></ul>
<div style="margin-bottom:2em;padding-bottom:1em;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:#C5B172;" ></div>
<a name='5'></a><h2 style="font-size:20px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;" >
Starting Your Cloud Infrastructure
</h2>
<h3 style="font-size:16px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;" >
What Cloud Computing Can Mean for Your Business, Part II
</h3>
<div>
Starting out, what do we need? We have to be able to communicate
with our customers and suppliers, so we need email, perhaps instant
messaging. If we have overseas or long distance clients, some kind of VOIP
phone would help to keep costs down.
</div>
<div>
We must ensure that anything we're working on is properly backed
up from the business plan to product concepts and beyond. Any loss
of data could be crucial when getting your product or service to market at
the right time. Keeping an eye on our schedule is vital to make sure
important events, tasks, and meetings are managed.<br />
</div>
<div>
There's a lot more to address, but this much is enough to get us
up and running so we can get about the business of doing business.
 But if you're not an IT person and you don't know how to
setup email servers or backup systems, where do you begin?
</div>
<h3>
Email
</h3>
<div>
Google has been a provider of innovative products in the cloud for some
time, but many are unaware just how powerful these applications can be.
Gmail, for example, offers free email accounts with enormous amounts of
storage, and an easy-to-use interface. Your email can be accessed from
anywhere, you never have to delete as everything can be archived, and
backups are taken care of for you. The only issue is that you may want to
avoid sending emails to a big potential client from an anonymous, free
Gmail account; to make a proper impression, you need to be able to have
your own email address under your company name.
</div>
<div>
Google can still help you here, though; you can actually use the Gmail
system with your own domain name. As long as you have a <a
mce_href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/o"
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/o">domain</a>, you can purchase a
Google Apps for Business account for the trifling sum of US$50 a year,
which lets you transfer your email hosting to Google's servers.
It's a very simple process, and once done you have full IMAP
access to your email from anywhere in the world, with a guarantee of
availability and uptime that few can compete with certainly not in a
small business.
</div>
<div>
The cost increases as you add more email accounts, but it's still
less than you'd pay to host a server with your own email software on
it. You can set up a normal email client like Outlook or Apple mail to use
the server, or use the user-friendly Gmail interface on the Web. This
means that no matter what happens, you'll always have access to email and
the ability to send from your own email address, even if your personal
computers fail. There are more great benefits to using Google Apps, but
we'll explore those in the next article. For now, check out <a
mce_href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/b" href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/b">Google Apps
for Business</a> to get up and running with your email.
</div>
<h3>
Messaging
</h3>
Note: I removed a lot of code here in the middle so that it would allow me to post the size of this document.
<hr color="#c5b172" size="1" /><h2
style="font-size:15px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;"><a
name='11'></a>New Technical Articles</h2><h3><a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/tu"
style="color:#7B7B94"><strong>CSS3 Border Images for Beautiful, Flexible
Boxes</strong></a></h3>
<p><img src="http://i8.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/author_louis_lazaris_17.jpg"
hspace="3" alt="Louis Lazaris" align="left" width="67" height="80" />Among
the raft of CSS3 features gaining increasing levels of browser support, the
border-image property is often overlooked. In this article, Louis gives us
the lowdown on what it is and how to use it.</p>
<p align="right"><a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/il"
style="color:#7B7B94">Full Story...</a></p><h3><a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/ir"
style="color:#7B7B94"><strong>HTML5 and Even Fancier
Forms</strong></a></h3>
<p><img src="http://i9.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/author_tim_connell_18.jpg"
hspace="3" alt="Tim Connell" align="left" width="67" height="80" />Tim
Connell, co-author of SitePoint's Fancy Form Design, takes a look at
the new form input types available in HTML5, and gives you the skinny on
which ones you can start using right now.</p>
<p align="right"><a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/iy"
style="color:#7B7B94">Full Story...</a></p>
<h2
style="font-size:15px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;margin-top:2em;padding-top:1em;border-top:
1px dotted #C5B172;"><a name='12'></a>Techy Forum Threads</h2><ul
class="forums" style="margin-left:18px;padding-left:0;" ><li><a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/ij"
style="color:#7B7B94">How do you organize your CSS?</a> in CSS</li><li><a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/it"
style="color:#7B7B94">Jack of all Trades...</a> in .NET</li><li><a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/ii"
style="color:#7B7B94">Personification of software: The contest</a> in
General Chat</li></ul>
<hr color="#c5b172" size="1" /><h2
style="font-size:15px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;"><a
name='13'></a>More Techy Blog Entries</h2><p style="font-size:80%;color:#aea194;" >Web Tech</p><table cellpadding="0" cellspacing="0"
border="0" width="100%"><tbody><tr>
<td valign="top"><img
src="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"
height="19" /></td>
<td width="7"></td>
<td style="font-family:verdana;font-size:13px;" >
<a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/id"
style="color:#7B7B94">The Threat to Software Freedom</a>
</td>
</tr><tr>
<td colspan="2"></td>
<td><font size="-2" style="color:#AEA193;" >1 comment</td>
</tr><tr>
<td height="3"></td>
</tr><tr>
<td valign="top"><img
src="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"
height="19" /></td>
<td width="7"></td>
<td style="font-family:verdana;font-size:13px;" >
<a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/ih"
style="color:#7B7B94">Apple: Stuff Ups, Mistakes, and Finally Moving
Forward?</a>
</td>
</tr><tr>
<td colspan="2"></td>
<td><font size="-2" style="color:#AEA193;" >19 comments</td>
</tr><tr>
<td height="3"></td>
</tr><tr>
<td valign="top"><img
src="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"
height="19" /></td>
<td width="7"></td>
<td style="font-family:verdana;font-size:13px;" >
<a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/ik"
style="color:#7B7B94">Behind the Geek Out Scenes: Fancy Fonts and Jaunty
Input Fields</a>
</td>
</tr><tr>
<td colspan="2"></td>
<td><font size="-2" style="color:#AEA193;" >12 comments</td>
</tr><tr>
<td height="3"></td>
</tr></tbody></table><p style="font-size:80%;color:#aea194;" >JavaScript, CSS</p><table cellpadding="0" cellspacing="0"
border="0" width="100%"><tbody><tr>
<td valign="top"><img
src="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"
height="19" /></td>
<td width="7"></td>
<td style="font-family:verdana;font-size:13px;" >
<a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/iu"
style="color:#7B7B94">High-performance String Concatenation in
JavaScript</a>
</td>
</tr><tr>
<td colspan="2"></td>
<td><font size="-2" style="color:#AEA193;" >11 comments</td>
</tr><tr>
<td height="3"></td>
</tr></tbody></table><p style="font-size:80%;color:#aea194;" >Web
Design</p><table cellpadding="0" cellspacing="0" border="0"
width="100%"><tbody><tr>
<td valign="top"><img
src="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"
height="19" /></td>
<td width="7"></td>
<td style="font-family:verdana;font-size:13px;" >
<a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dl"
style="color:#7B7B94">WordPress Trademark Transferred To WordPress
Foundation</a>
</td>
</tr><tr>
<td colspan="2"></td>
<td><font size="-2" style="color:#AEA193;" >2 comments</td>
</tr><tr>
<td height="3"></td>
</tr></tbody></table><p style="font-size:80%;color:#aea194;" >Community</p><table cellpadding="0" cellspacing="0" border="0"
width="100%"><tbody><tr>
<td valign="top"><img
src="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"
height="19" /></td>
<td width="7"></td>
<td style="font-family:verdana;font-size:13px;" >
<a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dr"
style="color:#7B7B94">Important People With Things to Say</a>
</td>
</tr><tr>
<td height="3"></td>
</tr></tbody></table><hr color="#c5b172" size="1" />
</td>
<td width="10"></td>
</tr>
<tr>
<td width="10"></td>
<td width="20"
background="http://i5.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/vertical-rule-bg_14.gif"></td>
<td width="180" valign="bottom" style="color:#000000;font-family:verdana;font-size:13px;" >
<div id="subscribe">
<h2 style="font-size:15px;font-weight:bold;color:#073064;font-family:Arial, Helvetica, sans-serif;line-height:110%;" >
Follow SitePoint on..
</h2>
<ul style="margin-left:5px;list-style-type:none;list-style-position:outside;list-style-image:none;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<li style="font-size:15px;" >
<img src="http://i1.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-nl_20.gif"
border="0" height="27" width="27" align="bottom" alt="Newsletters" /><a
style="margin-left:5px; text-decoration:none; font-weight:400"
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dy">Newsletters</a>
</li>
<li style="font-size:15px;" >
<img src="http://i2.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-tw_21.gif"
border="0" height="27" width="27" align="bottom" alt="Twitter" /><a
style="margin-left:5px; text-decoration:none; font-weight:400"
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dj" rel="nofollow">Twitter</a>
</li>
<li style="font-size:15px;" >
<img src="http://i3.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-m_22.gif" border="0"
height="27" width="27" align="bottom" alt="Mobile" /><a
style="margin-left:5px; text-decoration:none; font-weight:400"
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dt">Mobile</a>
</li>
<li style="font-size:15px;" >
<img src="http://i4.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-pod_23.gif"
border="0" height="27" width="27" align="bottom" alt="Podcast" /><a
style="margin-left:5px; text-decoration:none; font-weight:400"
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/di">Podcast</a>
</li>
<li style="font-size:15px;" >
<img src="http://i5.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-rss_24.gif"
border="0" height="27" width="27" align="bottom" alt="RSS" /><a
style="margin-left:5px; text-decoration:none; font-weight:400"
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dd">RSS</a>
</li>
<li style="font-size:15px;" >
<img src="http://i6.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-fb_25.gif"
border="0" height="27" width="27" align="bottom" alt="Facebook" /><a
style="margin-left:5px; text-decoration:none; font-weight:400"
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dh" rel="nofollow">Facebook</a>
</li>
</ul>
</div>
<h2
style="font-size:15px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;">Help
Your Friends Out</h2>
<p>People you care about can benefit from the wealth of information on
new
and maturing technologies available on the Internet. Help them learn
how to do it by forwarding them this issue of the Tech Times!</p>
<!--[if gte mso 0]><div style="display:none;" ><![endif]-->
<table cellspacing="0" cellpadding="0" bgcolor="#F9990C">
<tr>
<td colspan="3" height="3" bgcolor="#C2721C"></td>
</tr>
<tr>
<td colspan="3" height="10"></td>
</tr>
<tr>
<td width="10"></td>
<td style="color:#ffffff;font-family:verdana;font-size:13px;font-weight:bold;" >Send this to a friend</td>
<td width="20"></td>
</tr>
<tr>
<td colspan="3" height="5"></td>
</tr>
<tr>
<td width="10"></td>
<td style="font-family:verdana;font-size:13px;" >
<form autocomplete="on"
action="http://www.sitepoint.com/newsletter/forward" method="get"
style="margin: 0pt;">
<input name="newsletterid" value="3" type="hidden">
<input name="fromemail" value="rcavezza#gmail.com" type="hidden">
<input name="issuenum" value="309" type="hidden">
<input autocomplete="on" name="email" value="friend#example.com"
style="width: 120px;" type="text">
<br />
<input autocomplete="on" name="Send" value="Send" type="submit">
</form>
</td>
<td width="20"></td>
</tr>
<tr>
<td colspan="3" height="10"></td>
</tr>
</table>
<!--[if gte mso 0]></div><![endif]-->
</td>
<td width="10"></td>
</tr>
<tr>
<td colspan="5" height="20"></td>
</tr>
<tr>
<td colspan="5" height="10" bgcolor="#9999BC"></td>
</tr>
<tr>
<td bgcolor="#D7D7E5"></td>
<td bgcolor="#D7D7E5" colspan="4" style="font-family:verdana;font-size:10px;color:#5e5e91;" >
<table width="100%" cellspacing="0" cellpadding="0"
style="font-size:12px">
<tbody>
<tr>
<td width="100%" height="10" bgcolor="#D7D7E5"></td>
<td rowspan="3" bgcolor="#032a5c" style="color:#FFF;font-size:12px;text-align:center;" >
We send this newsletter using Campaign Monitor<br/>
<br/>
<a
href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dk"><img
src="http://i7.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/cm-passive-200x125_26.png" width="200"
height="125" hspace="10" border="0" alt="Campaign Monitor"/></a>
</td>
</tr>
<tr>
<td style="font-size:12x!important;font-family:arial,
verdana;" >
<p style="font-weight:bold;color:#353553;" >You are
subscribed as: <br>
<span style="font-size:13px;color:#CE6E11;font-weight:700;" ><code>rcavezza#gmail.com</code></span></p>
<ul>
<li><a href="http://sitepointcom.cmail2.com/t/y/u/cvkit/ddktkrydd/"
style="color:#7B7B94">Unsubscribe</a> from this list.</li>
<li><a href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/du"
style="color:#7B7B94">Manage your subscriptions</a>.</li>
<li><a href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/hl"
style="color:#7B7B94">View the newsletter archives</a>.</li>
</ul>
<p>
<span style="font-weight:bold;color:#353553;" >Mailing
Address:</span><br />
<span style="font-size:12px;" >48 Cambridge St, Collingwood, VIC,
3066 Australia</span>
</p>
<p><strong><span style="color:#353553;" >Phone:</span> +61 3
9090 8200</strong></p>
</td>
</tr>
<tr>
<td height="10" bgcolor="#D7D7E5"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<img src="https://cmail2.com/t/y/o/cvkit/ddktkrydd/o.gif" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" ></body>
EDIT: Just changed it to fix the issues below, and it's still not passing the validation test - any additional steps I should take/try?
It is not that badly formed. Just call quoted_printable_decode() on it first.
edit: well, it solves a few problems, but it is still misformed as *********. Whatever possessed them not to quote whole lists of style declarations?
edit2: Ah, Bob removed the quotes all on his own. I assume with leaving the quotes there & quoted printable decode it would be solved.
Yea that looks like a mess, have you looked into or tried something like htmlPurifier?
There are a few others, but I do not know them as the only one I ever used was the htmlPurifier, but you may want to look into that (if that is what you are asking for).
You can use tidy to repair your HTML. But it looks very bad so you should start with fixing the script that produces the HTML before.
On a windows machine you might have to add or uncomment the following line in your php.ini to be able to use it:
extension=php_tidy.dll
Some very basic example from the documentation:
$html = '<p>test</I>';
$tidy = tidy_parse_string($html);
$tidy->cleanRepair();
echo $tidy;
This will output the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
</head>
<body>
<p>test</p>
</body>
</html>

Categories