html email

Reply

Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

html email

 
0
  #1
Aug 6th, 2008
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
$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%;'>&nbsp;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%'>&nbsp;</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%'>&nbsp;</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+
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: html email

 
0
  #2
Aug 6th, 2008
This script is working fine for me! I get mails with html tags.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

Re: html email

 
0
  #3
Aug 6th, 2008
this is my whole code
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%;'>&nbsp;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%'>&nbsp;</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%'>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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%;'>&nbsp;Qualification Details</td><br /><br />";

$body2.="<br /><td width='12%' class='bar' style='width:5%; text-align:right; font-style:italic;'>&nbsp;</td><td width='6%' style='width:1%'>&nbsp;</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%;'>&nbsp;Professional Details</td><br />";

$body2.="<br /><td class='bar' style='width:5%; text-align:right; font-style:italic;'>&nbsp;</td><br />";

$body2.="<br />
<td style='width:1%'>&nbsp;</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%;'>&nbsp;Resume</td><td class='bar' style='width:5%; text-align:right; font-style:italic;'>&nbsp;</td><br />";

$body2.="<br /><td style='width:1%'>&nbsp;</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'>&nbsp;</td><td>&nbsp;</td><br />";

$body2.="<br /></tr><tr><td width='16'>&nbsp;</td><td width='867' colspan='100%' valign='bottom' class='input'><table  class='b'><br />";

$body2.="<br />
<tr><td width='10'>&nbsp;</td><td width='813' align='left' class='resume'><br />";

$body2.="<br /></td></tr></table></td></tr></table></td></tr><tr><td width='16'>&nbsp;</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%;'>&nbsp;Employement Details</td><br />";

$body2.="<br /><td class='bar' style='width:5%; text-align:right; font-style:italic;'>&nbsp;</td>
<td style='width:1%'>&nbsp;</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'>&nbsp;</td></tr><tr><td width='24%' class='style2' style='width: 30%'>&nbsp;&nbsp;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'>&nbsp;</td></tr><tr><td class='style2' style='width: 30%'>&nbsp;&nbsp;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'>&nbsp;</td></tr><tr><td class='style2' style='width: 30%'>&nbsp;&nbsp;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'>&nbsp;</td></tr><br />";

$body2.="<br />

 <tr><td class='style2' style='width: 30%'>&nbsp;&nbsp;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'>&nbsp;</td></tr><tr><td class='style2'><strong>&nbsp;&nbsp;Target Location</strong></td><br />";

$body2.="<br /><td >&nbsp;</td></tr> <tr><td colspan='100%' style='height: 3px;' /></tr><tr><br />";

$body2.="<br />
 <td class='style2' style='width: 30%'>&nbsp;&nbsp;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'>&nbsp;</td></tr><br />";

$body2.="<br />
</table></td></tr><tr><td>&nbsp;</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>
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: html email

 
0
  #4
Aug 6th, 2008
If you echo $body2, you will see an encoded string. That is because, you are using base64_encode for $body2.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

Re: html email

 
0
  #5
Aug 6th, 2008
then plz tell how to do.now i am getting only the personal details and regards in the last line
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

Re: html email

 
0
  #6
Aug 6th, 2008
when i execute the second code which i have send i am getting something like the below output

OUTPUT:

PGh0bWw+PGhlYWQ+PC9oZWFkPjxib2R5Pjx0YWJsZSB3aWR0aD0nODUwcHgnIGJvcmRlcj0nMCcg YWxpZ249J2NlbnRlcicgY2VsbHBhZGRpbmc9JzAnIGNlbGxzcGFjaW5nPScwJyBzdHlsZT0ndmVy dGljYWwtYWxpZ246dG9wOyc+PGJyIC8+
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: html email

 
0
  #7
Aug 6th, 2008
Hmm.. Comment out this line $body2=rtrim(chunk_split(base64_encode($body2))); for time being ! I am wondering why it is not working! I hope someone else has an answer
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: html email

 
0
  #8
Aug 6th, 2008
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
  1. $body2.="<table width='850px' border='0' align='center' cellpadding='0' cellspacing='0' style='vertical-align:top;'>";
you'll have to get rid of those single quotes:
  1. $body2.="<table width=850px border=0 align=center cellpadding=0 cellspacing=0 style=vertical-align:top;>";
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.
Lost time is never found again.
- Benjamin Franklin
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC