roldahayes Posted November 18, 2008 Share Posted November 18, 2008 Hi, the below code generates a confirmation when someone orders something and emails it to them. My question is, how would I best go about putting an advertising banner at the bottom of their email which is linked somewhere? Cheers, <?php //get confirmation or customerID etc $shopperID = stripslashes($_POST['Shopper_ID']); // set up mail details $mail_to = stripslashes($_POST['Customer_Email']); $mail_from = "********"; $mail_subject = "Order Confirmation"; $mail_headers = "FROM: $mail_from\r\n"; //added additional recipient $mail_body = "Dear Customer,\n\nYour order has been sent to us successfully and you should have printed the order confirmation page. If you do not have a copy, please make a note of the following ShopperID :- ".$shopperID." You may refer to this if you have any queries.\n\nWe will contact you to confirm your order.". "\n\nThank you"; //create mail footer message $mail_footer = "\n\nFooter Message Here!"; //concatinate mail_body and mail_footer $mail_body = $mail_body . $mail_footer; // send mail if (mail($mail_to, $mail_subject, $mail_body, $mail_headers)) { //echo ("<p>Message sent</p>"); } else { echo ("<p>Error On Sending Mail</p>"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/133202-can-i-insert-a-banner-image-into-here/ Share on other sites More sharing options...
DeanWhitehouse Posted November 18, 2008 Share Posted November 18, 2008 what do you mean? Do you mean a dynamic image generated using PHP or just a static one. For a static one <a href="http://whereto.com"><img src="image.gif" alt=""></a> Quote Link to comment https://forums.phpfreaks.com/topic/133202-can-i-insert-a-banner-image-into-here/#findComment-692773 Share on other sites More sharing options...
roldahayes Posted November 18, 2008 Author Share Posted November 18, 2008 Yes the same one on all emails - I thought it would be harder than that! Quote Link to comment https://forums.phpfreaks.com/topic/133202-can-i-insert-a-banner-image-into-here/#findComment-692776 Share on other sites More sharing options...
DeanWhitehouse Posted November 18, 2008 Share Posted November 18, 2008 No, its quite simple If it is solved press solved at the bottom left of the page. Quote Link to comment https://forums.phpfreaks.com/topic/133202-can-i-insert-a-banner-image-into-here/#findComment-692782 Share on other sites More sharing options...
roldahayes Posted November 18, 2008 Author Share Posted November 18, 2008 When i try to insert the image link into the //create mail footer message $mail_footer = "\n\message here!"; It dosn't send the confirmation...? Quote Link to comment https://forums.phpfreaks.com/topic/133202-can-i-insert-a-banner-image-into-here/#findComment-692794 Share on other sites More sharing options...
DeanWhitehouse Posted November 18, 2008 Share Posted November 18, 2008 You need to escape the tags. <a href=\"http://whereto.com\"><img src=\"image.gif\" alt=\"\"></a> Quote Link to comment https://forums.phpfreaks.com/topic/133202-can-i-insert-a-banner-image-into-here/#findComment-692804 Share on other sites More sharing options...
roldahayes Posted November 18, 2008 Author Share Posted November 18, 2008 Ok, so I have it like this: //create mail footer message $mail_footer = "<a href=\"http://www.quizbay.com\"><img src=\"quizbay.jpg\" alt=\"\"></a>"; It just displays the code on the email? Quote Link to comment https://forums.phpfreaks.com/topic/133202-can-i-insert-a-banner-image-into-here/#findComment-692812 Share on other sites More sharing options...
DeanWhitehouse Posted November 18, 2008 Share Posted November 18, 2008 You need to read up on headers http://uk3.php.net/manual/en/function.mail.php Quote Link to comment https://forums.phpfreaks.com/topic/133202-can-i-insert-a-banner-image-into-here/#findComment-692870 Share on other sites More sharing options...
roldahayes Posted November 19, 2008 Author Share Posted November 19, 2008 Ok, i read the link and thought i'd got it sussed... but still not sending... heres what I have so far with the $headers included <?php // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; //get confirmation or customerID etc $shopperID = stripslashes($_POST['Shopper_ID']); // set up mail details $mail_to = stripslashes($_POST['Customer_Email']); $mail_from = "info@******.co.uk"; $mail_subject = "Order Confirmation"; $mail_headers = "FROM: $mail_from\r\n"; //added additional recipient $mail_body = "Dear Customer,\n\nYour order has been sent to us successfully and you should have printed the order confirmation page. If you do not have a copy, please make a note of the following ShopperID :- ".$shopperID." You may refer to this if you have any queries.\n\nWe will contact you to confirm your order.". "\n\nThank you for buying through us"; //create mail footer message $mail_footer = "<a href=\"http://www.quizbay.com\"><img src=\"quizbay.jpg\" alt=\"\"></a>"; //concatinate mail_body and mail_footer $mail_body = $mail_body . $mail_footer; // send mail if (mail($mail_to, $mail_subject, $mail_body, $mail_headers)) { //echo ("<p>Message sent</p>"); } else { echo ("<p>Error On Sending Mail</p>"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/133202-can-i-insert-a-banner-image-into-here/#findComment-693341 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.