| | |
html email
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2007
Posts: 183
Reputation:
Solved Threads: 5
hi,
i written a code for sending html maIL.MAIL FUNCTION IS WORKING BUT THE MAIL I AM GETTING I HAVE DISPLAYED BELOW.please do tell me how to send html mail
OUTPUT:
PGh0bWw+PGhlYWQ+PC9oZWFkPjxib2R5Pjx0YWJsZSB3aWR0aD0nODUwcHgnIGJvcmRlcj0nMCcg YWxpZ249J2NlbnRlcicgY2VsbHBhZGRpbmc9JzAnIGNlbGxzcGFjaW5nPScwJyBzdHlsZT0ndmVy dGljYWwtYWxpZ246dG9wOyc+PGJyIC8+
i written a code for sending html maIL.MAIL FUNCTION IS WORKING BUT THE MAIL I AM GETTING I HAVE DISPLAYED BELOW.please do tell me how to send html mail
$headers = "From: cggroup@car.com"; $toa = "lydia@gmail.com"; $subject1 = "An Agreement has been signed for your Job Order"; $body2="<html><head></head><body>"; $body2.="<table width='850px' border='0' align='center' cellpadding='0' cellspacing='0' style='vertical-align:top;'>"; $body2.="<br /><tr><td valign='top'><table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'><br /><br />"; $body2.="<br /><tr><td colspan='100%' style='width:100%'><br /><br />"; $body2.="<br /> <table style='width:100%;' cellspacing='0' cellpadding='0'><tr><td class='bar' style='width:80%;'> Personal Details</td> Hi $ownername, <br /><br />"; $body2.="<br /><td class='bar' style='width:5%; text-align:right; font-style:italic;'></td><td style='width:1%'> </td></tr><br /><br />"; $body2.="<br /></table></td></tr><tr><td><table width='100%' border='0' align='left' > Hi $ownername, <br /><br />"; $body2.="<br /><tr><td height='124' colspan='2'><table width='100%' border='0'><tr><br /><br />"; $body2.="<br /><td width='6%'> </td><td width='25%' align='left'><span class='heading' style='width: 10%'>Name:</span></td><br /><br />"; $body2.="<br /><b>With Regards,</b><br /><b>CG Group</b><br />"; $body2.="</body></html>"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=iso-8859-1" . "\r\n"; if (strlen($body2)>998) { $headers .= "Content-Transfer-Encoding: base64;" . "\r\n"; $body2=rtrim(chunk_split(base64_encode($body2))); $headers .= 'From: ' . $from . "\r\n" .'X-Mailer: PHP/' . phpversion(); } $sent = mail($toa, $subject1, $body2, $headers)
OUTPUT:
PGh0bWw+PGhlYWQ+PC9oZWFkPjxib2R5Pjx0YWJsZSB3aWR0aD0nODUwcHgnIGJvcmRlcj0nMCcg YWxpZ249J2NlbnRlcicgY2VsbHBhZGRpbmc9JzAnIGNlbGxzcGFjaW5nPScwJyBzdHlsZT0ndmVy dGljYWwtYWxpZ246dG9wOyc+PGJyIC8+
•
•
Join Date: Nov 2007
Posts: 183
Reputation:
Solved Threads: 5
this is my whole code
then wats wrong
just run this and see
then wats wrong
just run this and see
<html> <head></head> <body> <? $headers = "From: cggroup@car.com"; $toa = "lydia.whitin@gmail.com"; $subject1 = "An Agreement has been signed for your Job Order"; $body2="<html><head></head><body>"; $body2.="<table width='850px' border='0' align='center' cellpadding='0' cellspacing='0' style='vertical-align:top;'>"; $body2.="<br /><tr><td valign='top'><table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'><br /><br />"; $body2.="<br /><tr><td colspan='100%' style='width:100%'><br /><br />"; $body2.="<br /> <table style='width:100%;' cellspacing='0' cellpadding='0'><tr><td class='bar' style='width:80%;'> Personal Details</td> Hi $ownername, <br /><br />"; $body2.="<br /><td class='bar' style='width:5%; text-align:right; font-style:italic;'></td><td style='width:1%'> </td></tr><br /><br />"; $body2.="<br /></table></td></tr><tr><td><table width='100%' border='0' align='left' > Hi $ownername, <br /><br />"; $body2.="<br /><tr><td height='124' colspan='2'><table width='100%' border='0'><tr><br /><br />"; $body2.="<br /><td width='6%'> </td><td width='25%' align='left'><span class='heading' style='width: 10%'>Name:</span></td><br /><br />"; $body2.="<br /><td colspan='3' align='left'></td><br /><br />"; $body2.="<br /></tr><tr><td> </td><td align='left'><span class='heading' style='width: 10%'>Address1:</span></td><br /><br />"; $body2.="<br /><td colspan='3' align='left'> </td></tr><tr><td> </td><br /><br />"; $body2.="<br /><td align='left'><span class='heading' style='width: 10%'>Address2:</span></td><br /><br />"; $body2.="<br /><td colspan='3' align='left'> </td></tr><tr><td> </td><br /><br />"; $body2.="<br /><td align='left' nowrap='nowrap'><span class='heading' style='width: 10%'>Date of Birth:</span></td><br /><br />"; $body2.="<br /><td width='26%' align='left'> </td><br /><br />"; $body2.="<br /><td width='26%' align='left'> </td><br /><br />"; $body2.="<br /> <td width='7%' align='left'><span class='heading' style='width: 10%'>Age:</span></td><br /><br />"; $body2.="<br /> <td width='36%' align='left'> </td></tr><tr><td> </td><br /><br />"; $body2.="<br /> <td align='left'><span class='heading' style='width: 10%'>Location:</span></td><td colspan='3' align='left'><br /><br />"; $body2.="</td><br /><br />"; $body2.="<br /></tr><tr><td> </td><td class='heading'>Sex:</td><td colspan='3'> </td></tr><br /><br />"; $body2.="<br /></table></td><td width='43%'><table width='93%' bgcolor='#eeeeee'><tr><td colspan='2' align='left' class='bar'>Contact Information</td><br /><br />"; $body2.="<br /></tr><tr><td width='31%' height='30px' align='left' nowrap='nowrap'><span class='heading' style='width: 10%'>Home Phone:</span></td><br /><br />"; $body2.="<br /><td width='69%' align='left'> </td></tr><tr><br /><br />"; $body2.="<br /><td height='23px' align='left'><span class='heading' style='width: 10%'>Mobile:</span></td> <td align='left'> </td> </tr><tr><br /><br />"; $body2.="<br /> <td height='24' align='left'><span class='heading' style='width: 10%'>Email:</span></td> <td align='left'> </td><br /><br />"; $body2.="<br /></tr></table></td></tr></table></td></tr><tr><br /><br />"; $body2.="<br /><td><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td colspan='100%' style='height:5 px;' /></tr><br /><br />"; $body2.="<br /></table></td></tr><tr><td colspan='100%' style='height: 10px;' /></tr><tr><br /><br />"; $body2.="<br /> <td colspan='100%' style='width:100%'><table width='863' border='0' cellpadding='0' cellspacing='0' style='width:100%;'><br /><br />"; $body2.="<br /><tr><td width='82%' class='bar' style='width:80%;'> Qualification Details</td><br /><br />"; $body2.="<br /><td width='12%' class='bar' style='width:5%; text-align:right; font-style:italic;'> </td><td width='6%' style='width:1%'> </td><br /><br />"; $body2.="<br /></tr></table></td></tr><tr><br /><br />"; $body2.="<br /> <td><table width='788' border='0' align='center' cellpadding='0' cellspacing='0' ><tr><td style='height: 3px;' /></tr><br /><br />"; $body2.="<br /><tr><td valign='top' class='input' style='vertical-align:text-top;'><br /><br />"; $body2.="<br /><table width='100%' align='center' cellpadding='0' cellspacing='0' class='profile_table' ><tr><br /><br />"; $body2.="<br /><td style='height:15 px;' /></tr><tr><td class='table_title'>Qualification</td><td class='table_title'>Inst. Name</td><br /><br />"; $body2.="<br /<td class='table_title'>Start</td><td class='table_title'>End</td><td class='table_title'>Percentage</td></tr><br /><br />"; $body2.="<br /><tr><td align='center' colspan='100%' style='background-color: #05637C; width: 70%; height: 1px;' /></tr>br /><br />"; $body2.="<br /><tr><td colspan='100%' class='style2' style='width:100%; margin: 5; text-align:center;'>No Qualification added Yet</td><br /><br />"; $body2.="<br /></tr><br />"; $body2.="<br /><tr bgcolor='#eeeeee'><b> <td class='input'> </td></b><br />"; $body2.="<br /> <td class='input'> </td><br /><br />"; $body2.="<br /> <td class='input'> </td><br />"; $body2.="<br /><td class='input'> </td><br /><br />"; $body2.="<br /><td class='input'> </td></tr><br />"; $body2.="<br /><tr><td colspan='100%' style='height: 3px;' /></tr></table></td></tr></table><br />"; $body2.="<br /></td></tr><tr><td><table width='100%' border='0' cellspacing='0' cellpadding='0'><br />"; $body2.="<br /><tr><td colspan='100%' style='height:5 px;' /></tr></table></td></tr>><br />"; $body2.="<br /><tr><td colspan='100%' style='height: 10px;' /></tr><tr><td colspan='100%' style='width:100%'><br />"; $body2.="<br /><table style='width:100%;' cellspacing='0' cellpadding='0'><tr><br />"; $body2.="<br /> <td class='bar' style='width:80%;'> Professional Details</td><br />"; $body2.="<br /><td class='bar' style='width:5%; text-align:right; font-style:italic;'> </td><br />"; $body2.="<br /> <td style='width:1%'> </td></tr></table></td></tr><tr><br />"; $body2.="<br /> <td><table width='92%' border='0' align='center' cellpadding='0' cellspacing='0'><br />"; $body2.="<br /><tr><td colspan='100%' style='height:5 px;' /></tr><tr><td colspan='3'><table width='100%' align='center' cellpadding='0' cellspacing='0' ><br />"; $body2.="<br /><tr><td colspan='100%' style='height: 3px;' /></tr><tr><td style='vertical-align:text-top;' colspan='100%' class='input'><br />"; $body2.="<br /><table width='98%' align='center' cellpadding='0' cellspacing='0' class='profile_table'> <tr><td colspan='100%' style='height:15 px;' /></tr><br />"; $body2.="<br /><tr><td class='table_title'>Job Title</td><td class='table_title'>Comp. Name</td><td class='table_title'>Start</td><br />"; $body2.="<br /> <td class='table_title'>End</td><td class='table_title'>Comments</td></tr><br />"; $body2.="<br /><tr><td align='center' colspan='100%' style='background-color: #05637C; width: 70%; height: 1px;' /></tr><br />"; $body2.="<br /><tr><td colspan='100%' style='height: 3px;' /></tr><br />"; $body2.="<br /> <tr><td colspan='100%' class='style2' style='width:100%; margin: 5; text-align:center;'>No Professional Details added Yet</td></tr><br />"; $body2.="<br /><tr bgcolor='#eeeeee'><br />"; $body2.="<br /><td class='input' ></td><td class='input'></td><br />"; $body2.="<br /> <td class='input'></td><br />"; $body2.="<br /><td class='input'></td><td class='input'></td><br />"; $body2.="<br /></tr><tr><td colspan='100%' style='height: 3px;' /></tr></table></td></tr></table></td><br />"; $body2.="<br /></tr></table></td></tr><tr><td colspan='100%' style='height: 10px;' /></tr><tr><br />"; $body2.="<br /><td colspan='100%' style='width:100%'><table style='width:100%;' cellspacing='0' cellpadding='0'><tr><br />"; $body2.="<br /><td class='bar' style='width:80%;'> Resume</td><td class='bar' style='width:5%; text-align:right; font-style:italic;'> </td><br />"; $body2.="<br /><td style='width:1%'> </td></tr></table></td></tr><tr><td><table width='100%' border='0' cellspacing='0' cellpadding='0'><br />"; $body2.="<br /><tr><td colspan='100%' style='height:5px;' /></tr><tr><td height='2px'> </td><td> </td><br />"; $body2.="<br /></tr><tr><td width='16'> </td><td width='867' colspan='100%' valign='bottom' class='input'><table class='b'><br />"; $body2.="<br /> <tr><td width='10'> </td><td width='813' align='left' class='resume'><br />"; $body2.="<br /></td></tr></table></td></tr></table></td></tr><tr><td width='16'> </td></tr><br />"; $body2.="<br /></table></td></tr></table></td></tr><tr><td><table width='877' border='0' align='center' cellpadding='0' cellspacing='0'><br />"; $body2.="<br /> <tr><td><table width='877' cellpadding='0' cellspacing='0'><tr><td class='bar' style='width:80%;'> Employement Details</td><br />"; $body2.="<br /><td class='bar' style='width:5%; text-align:right; font-style:italic;'> </td> <td style='width:1%'> </td><br />"; $body2.="<br /></tr></table></td></tr><tr><td height='37' colspan='5' style='width:100%;height:20px;'></td></tr><br />"; $body2.="<br /><tr><td valign='top'><table width='765' border='0' align='center' cellpadding='0' cellspacing='0' style=' border: 1px dotted #0033FF;'><br />"; $body2.="<br /><tr><td colspan='100%' width='100%' height='1px'> </td></tr><tr><td width='24%' class='style2' style='width: 30%'> Target Job Title</td><br />"; $body2.="<br /><td width='64%' class='input' style='width: 80%; font-size:10px;'><? echo $lin[1]; ?></td></tr><br />"; $body2.="<br /><tr><td colspan='100%' width='100%' height='1px'> </td></tr><tr><td class='style2' style='width: 30%'> Present Employer</td><br />"; $body2.="<br /><td class='input' style='width: 80%; font-size:10px;'></td> </tr><br />"; $body2.="<br /><tr><td colspan='100%' width='100%' height='1px'> </td></tr><tr><td class='style2' style='width: 30%'> Willing To Relocate</td><br />"; $body2.="<br /> <td class='input' style='width: 70%; font-size:10px;'> </td><br />"; $body2.="<br /> </tr><tr><td colspan='100%' width='100%' height='1px'> </td></tr><br />"; $body2.="<br /> <tr><td class='style2' style='width: 30%'> Annual Salary</td><br />"; $body2.="<br /> <td class='input' style='width: 70%; font-size:10px;'></td></tr><br />"; $body2.="<br /> <tr><td colspan='100%' width='100%' height='1px'> </td></tr><tr><td class='style2'><strong> Target Location</strong></td><br />"; $body2.="<br /><td > </td></tr> <tr><td colspan='100%' style='height: 3px;' /></tr><tr><br />"; $body2.="<br /> <td class='style2' style='width: 30%'> State:</td> <td class='input' style='width: 70%; font-size:10px;'><br />"; $body2.="<br /></td></tr><tr><td colspan='100%' style='height: 3px;'></td></tr><br />"; $body2.="<br /><tr><td colspan='100%' width='100%' height='1px'> </td></tr><br />"; $body2.="<br /> </table></td></tr><tr><td> </td></tr><br />"; $body2.="<br /> <tr><td><table width='100%' border='0' cellpadding='0' cellspacing='0' ><br />"; $body2.="<br /></table></td></tr></table></td></tr><br />"; $body2.="<br /></table><br />"; $body2.="<br /><b>With Regards,</b><br /><b>CG Group</b><br />"; $body2.="</body></html>"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=iso-8859-1" . "\r\n"; if (strlen($body2)>998) { $headers .= "Content-Transfer-Encoding: base64;" . "\r\n"; $body2=rtrim(chunk_split(base64_encode($body2))); $headers .= 'From: ' . $from . "\r\n" .'X-Mailer: PHP/' . phpversion(); } $sent = mail($toa, $subject1, $body2, $headers) ?> </body> </html>
Something of a side note, while most clients will let you send them html email, most will replace attributes if they have quotes (single or double) surrounding them. So if you want to send you'll have to get rid of those single quotes: Otherwise, big boys like hotmail and gmail will replace everything inside your quotes with meaningless garbage. Also, most of them don't even use a doctype so you are probably better off using html. These are some things that I learned the hard way.
php Syntax (Toggle Plain Text)
$body2.="<table width='850px' border='0' align='center' cellpadding='0' cellspacing='0' style='vertical-align:top;'>";
php Syntax (Toggle Plain Text)
$body2.="<table width=850px border=0 align=center cellpadding=0 cellspacing=0 style=vertical-align:top;>";
Lost time is never found again.
- Benjamin Franklin
- Benjamin Franklin
![]() |
Similar Threads
- HTML in Email (HTML and CSS)
- Need Help with HTML Email. (IT Professionals' Lounge)
- Looking for an HTML email designer... (Web Development Job Offers)
- Looking for an HTML email designer... (Community Introductions)
- Sending HTML email via PHP mail function (PHP)
- using html in my welcome email (HTML and CSS)
Other Threads in the PHP Forum
- Previous Thread: Help for class.smtp and class.phpmailer
- Next Thread: Web database design
Views: 644 | Replies: 7
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code codingproblem cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select send server sessions sms soap source space speed sql static structure syntax system table tutorial up-to-date update updates upload url validation validator variable video web wordpress xml youtube







This script is working fine for me! I get mails with html tags.