i need help to send email containing html code by php
Moderator: General Moderators
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
i need help to send email containing html code by php
i am sending this email to my inbox but it not showing me the data in my design formate.
function sendemails($title,$fname,$sname,$email){
$orderNo_ses= $_SESSION['orderNo'];
//$theCustName ="";
//$orderno = "";
$emailTo = $email;
//$emailTo = "nick@lovelljohns.com";
//$emailBody ="";
$strCustomerName = $title . $fname . " " .$sname;
$strCurrentOrderNo = $orderNo_ses;
$strEmailbody = "<html><head><meta http-equiv='Content-Type'content='text/html; charset=iso-8859-1'>";
$strEmailbody .= "<title>GreenAsap Order Confirmation</title>";
$strEmailbody .= "<style type='text/css'>";
$strEmailbody .= "<!--";
$strEmailbody .= ".maintext {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#000000}";
$strEmailbody .= ".green {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#85BC3F}";
$strEmailbody .= ".purple {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#00365A}";
$strEmailbody .= ".grey {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#808080}";
$strEmailbody .= "-->";
$strEmailbody .= "</style></head><body>";
$strEmailbody .= "<img src='http://www.mapsinternational.co.uk/nic_temp/header.bmp'>";
$strEmailbody .= "<p class='maintext'>Dear " . $strCustomerName . ",</p>";
$strEmailbody .= "<p class='maintext'>Report order: " . $strCurrentOrderNo . "</p>";
$strEmailbody .= "<p class='maintext'>Thank you for ordering a <span class='green'><strong>Green</strong></span><span class='purple'><strong>Light</strong></span><span class='grey'><strong> Report</strong><sup>®</sup></span>.";
$strEmailbody .= "Your report order will be shortly processed by one of our skilled Environmental Surveyors.";
$strEmailbody .= "<p class='maintext'>Remember to regularly check <strong><a href='www.greenasap.com' class='green'>www.greenasap.com</a></strong> for new products and advice relating to green issues and property.</p><br/><br/>";
$strEmailbody .= "<p class='maintext'>The Green ASAP Team<br/>Green ASAP Ltd<br/><strong><a href='www.greenasap.com' class='purple'>www.greenasap.com</a></strong></p>";
$strEmailbody .= "<img src='http://www.mapsinternational.co.uk/nic_temp/footer.bmp'>";
$strEmailbody .= "</body></html>";
$emailSubject = "Your GreenASAP Order: " . $orderNo_ses;
//$emailDear1 = "Dear '" . $title.$fname ."".$sname. "',\r\n\r\n";
//$strEmailbody .= "Thank you for your order" ;
//$strEmailbody .= "Order No. ". $orderNo_ses . "\r\n";
//$strEmailbody .= "Order Details";
//$orderString = "[w[odfkcsdcmks;dlcm";
//$strEmailbody .= $orderString . "\r\n\r\n";
//$strEmailbody.= "Regards,\r\n";
//$strEmailbody .= "Wilbourn Associates";
//$emailDear1 = "Dear '" . $fname . "',\r\n\r\n";
//$emailBody .= "Thank you for your order" ;
//$emailBody .= "Order No. ". $orderNo_ses . "\r\n";
//$emailBody .= "Order Details";
//$orderString = "[w[odfkcsdcmks;dlcm";
//$emailBody .= $orderString . "\r\n\r\n";
//$emailBody .= "Regards,\r\n";
//$emailBody .= "Wilbourn Associates";
//$fullEmailBody = $emailDear1 . $emailBody;
$fullEmailBody = $strEmailbody ;
// To send HTML mail, the Content-type header must be set
//headers = "From: $from\r\n";
$emailHeaders = "MIME-Version: 1.0rn";
//$headers .= "Content-type: text/html; charset=iso-8859-1rn";
$emailHeaders .= "Content-Type'content='text/html; charset=iso-8859-1";
//***Send email to user and account admin where necessary.
$emailHeaders = 'From: ' . 'ADMIN_EMAIL';
if(mail($emailTo, $emailSubject, $fullEmailBody, $emailHeaders, '-f'.'ADMIN_EMAIL')){
}else{
echo "<p class='error' align='center'>There has been a problem sending your cofirmation email. <br/>Ensure your email address is correct or contact Wilbourn.</p>";
}
}
.......................
the result in inbox of this code is
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
<html><head><meta http-equiv='Content-Type'content='text/html; charset=iso-8859-1'><title>GreenAsap Order Confirmation</title><style type='text/css'><!--.maintext {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#000000}.green {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#85BC3F}.purple {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#00365A}.grey {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#808080}--></style></head><body><img src='http://www.mapsinternational.co.uk/nic_ ... er.bmp'><p class='maintext'>Dear Mr.LOVELL JOHN,</p><p class='maintext'>Report order: ASAP00000121</p><p class='maintext'>Thank you for ordering a <span class='green'><strong>Green</strong></span><span class='purple'><strong>Light</strong></span><span class='grey'><strong> Report</strong><sup>®</sup></span>.Your report order will be shortly processed by one of our skilled Environmental Surveyors.<p class='maintext'>Remember to regularly check <strong><a href='www.greenasap.com' class='green'>www.greenasap.com</a></strong> for new products and advice relating to green issues and property.</p><br/><br/><p class='maintext'>The Green ASAP Team<br/>Green ASAP Ltd<br/><strong><a href='www.greenasap.com' class='purple'>www.greenasap.com</a></strong></p><img src='http://www.mapsinternational.co.uk/nic_ ... ody></html>
function sendemails($title,$fname,$sname,$email){
$orderNo_ses= $_SESSION['orderNo'];
//$theCustName ="";
//$orderno = "";
$emailTo = $email;
//$emailTo = "nick@lovelljohns.com";
//$emailBody ="";
$strCustomerName = $title . $fname . " " .$sname;
$strCurrentOrderNo = $orderNo_ses;
$strEmailbody = "<html><head><meta http-equiv='Content-Type'content='text/html; charset=iso-8859-1'>";
$strEmailbody .= "<title>GreenAsap Order Confirmation</title>";
$strEmailbody .= "<style type='text/css'>";
$strEmailbody .= "<!--";
$strEmailbody .= ".maintext {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#000000}";
$strEmailbody .= ".green {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#85BC3F}";
$strEmailbody .= ".purple {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#00365A}";
$strEmailbody .= ".grey {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#808080}";
$strEmailbody .= "-->";
$strEmailbody .= "</style></head><body>";
$strEmailbody .= "<img src='http://www.mapsinternational.co.uk/nic_temp/header.bmp'>";
$strEmailbody .= "<p class='maintext'>Dear " . $strCustomerName . ",</p>";
$strEmailbody .= "<p class='maintext'>Report order: " . $strCurrentOrderNo . "</p>";
$strEmailbody .= "<p class='maintext'>Thank you for ordering a <span class='green'><strong>Green</strong></span><span class='purple'><strong>Light</strong></span><span class='grey'><strong> Report</strong><sup>®</sup></span>.";
$strEmailbody .= "Your report order will be shortly processed by one of our skilled Environmental Surveyors.";
$strEmailbody .= "<p class='maintext'>Remember to regularly check <strong><a href='www.greenasap.com' class='green'>www.greenasap.com</a></strong> for new products and advice relating to green issues and property.</p><br/><br/>";
$strEmailbody .= "<p class='maintext'>The Green ASAP Team<br/>Green ASAP Ltd<br/><strong><a href='www.greenasap.com' class='purple'>www.greenasap.com</a></strong></p>";
$strEmailbody .= "<img src='http://www.mapsinternational.co.uk/nic_temp/footer.bmp'>";
$strEmailbody .= "</body></html>";
$emailSubject = "Your GreenASAP Order: " . $orderNo_ses;
//$emailDear1 = "Dear '" . $title.$fname ."".$sname. "',\r\n\r\n";
//$strEmailbody .= "Thank you for your order" ;
//$strEmailbody .= "Order No. ". $orderNo_ses . "\r\n";
//$strEmailbody .= "Order Details";
//$orderString = "[w[odfkcsdcmks;dlcm";
//$strEmailbody .= $orderString . "\r\n\r\n";
//$strEmailbody.= "Regards,\r\n";
//$strEmailbody .= "Wilbourn Associates";
//$emailDear1 = "Dear '" . $fname . "',\r\n\r\n";
//$emailBody .= "Thank you for your order" ;
//$emailBody .= "Order No. ". $orderNo_ses . "\r\n";
//$emailBody .= "Order Details";
//$orderString = "[w[odfkcsdcmks;dlcm";
//$emailBody .= $orderString . "\r\n\r\n";
//$emailBody .= "Regards,\r\n";
//$emailBody .= "Wilbourn Associates";
//$fullEmailBody = $emailDear1 . $emailBody;
$fullEmailBody = $strEmailbody ;
// To send HTML mail, the Content-type header must be set
//headers = "From: $from\r\n";
$emailHeaders = "MIME-Version: 1.0rn";
//$headers .= "Content-type: text/html; charset=iso-8859-1rn";
$emailHeaders .= "Content-Type'content='text/html; charset=iso-8859-1";
//***Send email to user and account admin where necessary.
$emailHeaders = 'From: ' . 'ADMIN_EMAIL';
if(mail($emailTo, $emailSubject, $fullEmailBody, $emailHeaders, '-f'.'ADMIN_EMAIL')){
}else{
echo "<p class='error' align='center'>There has been a problem sending your cofirmation email. <br/>Ensure your email address is correct or contact Wilbourn.</p>";
}
}
.......................
the result in inbox of this code is
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
<html><head><meta http-equiv='Content-Type'content='text/html; charset=iso-8859-1'><title>GreenAsap Order Confirmation</title><style type='text/css'><!--.maintext {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#000000}.green {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#85BC3F}.purple {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#00365A}.grey {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#808080}--></style></head><body><img src='http://www.mapsinternational.co.uk/nic_ ... er.bmp'><p class='maintext'>Dear Mr.LOVELL JOHN,</p><p class='maintext'>Report order: ASAP00000121</p><p class='maintext'>Thank you for ordering a <span class='green'><strong>Green</strong></span><span class='purple'><strong>Light</strong></span><span class='grey'><strong> Report</strong><sup>®</sup></span>.Your report order will be shortly processed by one of our skilled Environmental Surveyors.<p class='maintext'>Remember to regularly check <strong><a href='www.greenasap.com' class='green'>www.greenasap.com</a></strong> for new products and advice relating to green issues and property.</p><br/><br/><p class='maintext'>The Green ASAP Team<br/>Green ASAP Ltd<br/><strong><a href='www.greenasap.com' class='purple'>www.greenasap.com</a></strong></p><img src='http://www.mapsinternational.co.uk/nic_ ... ody></html>
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: i need help to send email containing html code by php
Im not saying it will solve the problem at hand but you can only use inline style with html emails.
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: i need help to send email containing html code by php
i already tried this code with oout styles i mean just simple html code but it give me same error
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: i need help to send email containing html code by php
So what is exactly your problem?
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: i need help to send email containing html code by php
my problom is to execute my html code in inbox in order to show my reply.
i design the above code it need to work.
but i dont what is missing there ,it is not working
i design the above code it need to work.
but i dont what is missing there ,it is not working
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: i need help to send email containing html code by php
These headers work perfectly for me:
Code: Select all
$from=me@moo.com";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
$headers .= "From: " . $from . "\r\n";
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: i need help to send email containing html code by php
IS IT POSSIBLE THAT I CAN GET HELP FROM SOME ONE ,
THANKS
THANKS
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: i need help to send email containing html code by php
IT IS SAME HEADERS WHAT I AM USING BUT REALY STRANGE WHY IT IS NOT WORKING ON MY CODE.
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: i need help to send email containing html code by php
They're not exactly the same. Notice the "\r\n"
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: i need help to send email containing html code by php
MMM OK I M GOING TO TRY
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: i need help to send email containing html code by php
i tried but sad ,not working
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: i need help to send email containing html code by php
is the only problem your formatting?
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: i need help to send email containing html code by php
done done done
thanks buddy you are right
i applied your code and it is working
thanks bro
thanks buddy you are right
i applied your code and it is working
thanks bro
-
asifkamalzahid
- Forum Commoner
- Posts: 36
- Joined: Tue Nov 18, 2008 8:00 am
Re: i need help to send email containing html code by php
his code is become like this and working
thanks
// sending message after payment successfull
function sendemails($title,$fname,$sname,$email){
//varaibles
$orderNo_ses= $_SESSION['orderNo'];
$emailTo = $email;
$strCustomerName = $title . $fname . " " .$sname;
$strCurrentOrderNo = $orderNo_ses;
//fullbody message
$strEmailbody = "<html><head><meta http-equiv='Content-Type'content='text/html; charset=iso-8859-1'>";
$strEmailbody .= "<title>GreenAsap Order Confirmation</title>";
$strEmailbody .= "<style type='text/css'>";
$strEmailbody .= "<!--";
$strEmailbody .= ".maintext {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#000000}";
$strEmailbody .= ".green {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#85BC3F}";
$strEmailbody .= ".purple {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#00365A}";
$strEmailbody .= ".grey {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#808080}";
$strEmailbody .= "-->";
$strEmailbody .= "</style></head><body>";
$strEmailbody .= "<img src='http://www.mapsinternational.co.uk/nic_temp/header.bmp'>";
$strEmailbody .= "<p class='maintext'>Dear " . $strCustomerName . ",</p>";
$strEmailbody .= "<p class='maintext'>Report order: " . $strCurrentOrderNo . "</p>";
$strEmailbody .= "<p class='maintext'>Thank you for ordering a <span class='green'><strong>Green</strong></span><span class='purple'><strong>Light</strong></span><span class='grey'><strong> Report</strong><sup>®</sup></span>.";
$strEmailbody .= "Your report order will be shortly processed by one of our skilled Environmental Surveyors.";
$strEmailbody .= "<p class='maintext'>Remember to regularly check <strong><a href='www.greenasap.com' class='green'>www.greenasap.com</a></strong> for new products and advice relating to green issues and property.</p><br/><br/>";
$strEmailbody .= "<p class='maintext'>The Green ASAP Team<br/>Green ASAP Ltd<br/><strong><a href='www.greenasap.com' class='purple'>www.greenasap.com</a></strong></p>";
$strEmailbody .= "<img src='http://www.mapsinternational.co.uk/nic_temp/footer.bmp'>";
$strEmailbody .= "</body></html>";
//subject
$emailSubject = "Your GreenASAP Order: " . $orderNo_ses;
//fullbody
$fullEmailBody = $strEmailbody ;
// To send HTML mail, the Content-type header must be set
$emailHeaders = "MIME-Version: 1.0\r\n";
$emailHeaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
$emailHeaders .= "Content-Transfer-Encoding: 7bit\r\n";
//***Send email to user and account admin where necessary.
$emailHeaders .= "From: " . 'ADMIN_EMAIL' . "\r\n";
if(mail($emailTo, $emailSubject, $fullEmailBody, $emailHeaders, '-f'.'ADMIN_EMAIL')){
}else{
echo "<p class='error' align='center'>There has been a problem sending your cofirmation email. <br/>Ensure your email address is correct or contact Wilbourn.</p>";
}
}
thanks
// sending message after payment successfull
function sendemails($title,$fname,$sname,$email){
//varaibles
$orderNo_ses= $_SESSION['orderNo'];
$emailTo = $email;
$strCustomerName = $title . $fname . " " .$sname;
$strCurrentOrderNo = $orderNo_ses;
//fullbody message
$strEmailbody = "<html><head><meta http-equiv='Content-Type'content='text/html; charset=iso-8859-1'>";
$strEmailbody .= "<title>GreenAsap Order Confirmation</title>";
$strEmailbody .= "<style type='text/css'>";
$strEmailbody .= "<!--";
$strEmailbody .= ".maintext {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#000000}";
$strEmailbody .= ".green {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#85BC3F}";
$strEmailbody .= ".purple {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#00365A}";
$strEmailbody .= ".grey {font-family: Helvetica, Arial, sans-serif;size: 12pt;color:#808080}";
$strEmailbody .= "-->";
$strEmailbody .= "</style></head><body>";
$strEmailbody .= "<img src='http://www.mapsinternational.co.uk/nic_temp/header.bmp'>";
$strEmailbody .= "<p class='maintext'>Dear " . $strCustomerName . ",</p>";
$strEmailbody .= "<p class='maintext'>Report order: " . $strCurrentOrderNo . "</p>";
$strEmailbody .= "<p class='maintext'>Thank you for ordering a <span class='green'><strong>Green</strong></span><span class='purple'><strong>Light</strong></span><span class='grey'><strong> Report</strong><sup>®</sup></span>.";
$strEmailbody .= "Your report order will be shortly processed by one of our skilled Environmental Surveyors.";
$strEmailbody .= "<p class='maintext'>Remember to regularly check <strong><a href='www.greenasap.com' class='green'>www.greenasap.com</a></strong> for new products and advice relating to green issues and property.</p><br/><br/>";
$strEmailbody .= "<p class='maintext'>The Green ASAP Team<br/>Green ASAP Ltd<br/><strong><a href='www.greenasap.com' class='purple'>www.greenasap.com</a></strong></p>";
$strEmailbody .= "<img src='http://www.mapsinternational.co.uk/nic_temp/footer.bmp'>";
$strEmailbody .= "</body></html>";
//subject
$emailSubject = "Your GreenASAP Order: " . $orderNo_ses;
//fullbody
$fullEmailBody = $strEmailbody ;
// To send HTML mail, the Content-type header must be set
$emailHeaders = "MIME-Version: 1.0\r\n";
$emailHeaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
$emailHeaders .= "Content-Transfer-Encoding: 7bit\r\n";
//***Send email to user and account admin where necessary.
$emailHeaders .= "From: " . 'ADMIN_EMAIL' . "\r\n";
if(mail($emailTo, $emailSubject, $fullEmailBody, $emailHeaders, '-f'.'ADMIN_EMAIL')){
}else{
echo "<p class='error' align='center'>There has been a problem sending your cofirmation email. <br/>Ensure your email address is correct or contact Wilbourn.</p>";
}
}
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London