pan1138 Posted November 1, 2006 Share Posted November 1, 2006 I am trying to make an autoresponse display an image that can be clicked on to take the recipient back to the site where they filled out the contact form. here is the code:[code]<?php $subject="You just received an email from www.yoursite.com : Contact Form";$recepient ="admin@yoursite.com";$body = "<br><strong>First Name:</strong> ".$_REQUEST['first_name']."<br><strong>Last Name:</strong> ".$_REQUEST['last_name']."<br><strong>Email:</strong> ".$_REQUEST['email']."<br><strong>Address:</strong> ".$_REQUEST['addr1']."<br><strong>Apt/Suite/Box:</strong> ".$_REQUEST['apt_suite']."<br><strong>City:</strong> ".$_REQUEST['city']."<br><strong>State:</strong> ".$_REQUEST['state']."<br><strong>Zip Code:</strong> ".$_REQUEST['zip']."<br><strong>Country:</strong> ".$_REQUEST['country']."<br><strong>Telephone:</strong> ".$_REQUEST['phone']."<br><strong>Email:</strong> ".$_REQUEST['email']."<br><strong>Residence Type:</strong> ".$_REQUEST['residence_type']."<br><strong>Price Range:</strong> ".$_REQUEST['price_range']."<br><strong>Where Did You Hear About Us?:</strong> ".$_REQUEST['heard_about'];$email = $_REQUEST['email'];ini_set("SMTP","mail.yoursite.com"); ini_set("smtp_port","25"); ini_set("sendmail_from","contact@yoursite.com"); mail($recepient,$subject,$body,"FROM: $email\nContent-Type: text/html");$subject="Thank you for your interest in www.yoursite.com : Contact Form";$body = <<<EOF <html><body><br>Thank you for your submission!<br><br>Click on the image below for your confirmation!<br><br><a href="http://www.yoursite.com/thankyou.html"><img src="http://www.yoursite.com/thanks.jpg" alt="Thanks!" width="244" height="165"></a><br></body></html> EOF;ini_set("SMTP","mail.yoursite.com"); ini_set("smtp_port","25"); ini_set("sendmail_from","contact@yoursite.com"); mail($email,$subject,$body,"FROM: contact@yoursite.com\nContent-Type: text/html");echo("<META HTTP-EQUIV='Refresh' CONTENT='0;URL=http://www.yoursite.com'>");?> [/code]Anyone have any suggestions? I am dead in the water and would be extremely grateful for any feedback... Quote Link to comment https://forums.phpfreaks.com/topic/25775-cannot-display-a-link-or-image-with-absolute-url-in-autoresponder/ Share on other sites More sharing options...
btherl Posted November 1, 2006 Share Posted November 1, 2006 What are you expecting to happen, and what is actually happening? Also, which program are you viewing the email in? Quote Link to comment https://forums.phpfreaks.com/topic/25775-cannot-display-a-link-or-image-with-absolute-url-in-autoresponder/#findComment-117695 Share on other sites More sharing options...
pan1138 Posted November 1, 2006 Author Share Posted November 1, 2006 The top part of the code sends a notification to the admin with the form dataThe second part sends an acknowledgement email to the sender of the form.It is not specific to any email program, when I made the second part just text without any URLs, it worked fine.When I attempted to make it HTML with an image linked to it it does not work.Am I explaining this properly? Thanks for your response! Quote Link to comment https://forums.phpfreaks.com/topic/25775-cannot-display-a-link-or-image-with-absolute-url-in-autoresponder/#findComment-117699 Share on other sites More sharing options...
btherl Posted November 1, 2006 Share Posted November 1, 2006 Yes, that's helpful :) Just a few more questions - how doesn't it work? Does the image appear, but nothing happens when you click on it? Or is there no image appearing? And in which email program does it not work? The program you are testing with is relevant to diagnosing the problem.Or does the email simply not get sent? Or not arrive? Spam filters can sometimes cause non-arrival even when an email is being sent.Your html looks ok.. an img inside an "a href" should make a clickable image. Quote Link to comment https://forums.phpfreaks.com/topic/25775-cannot-display-a-link-or-image-with-absolute-url-in-autoresponder/#findComment-117701 Share on other sites More sharing options...
pan1138 Posted November 1, 2006 Author Share Posted November 1, 2006 ok - here is the problem - it never gets sent, it never gets to the REFRESH stage (second line from the bottom)If I do all this as plain text it works fine.I am checking the emails in Outlook 2003 for windows and Entourage 2004 for Mac. It has worked... it is just when I insert the HTML code that it chokes. >:( Quote Link to comment https://forums.phpfreaks.com/topic/25775-cannot-display-a-link-or-image-with-absolute-url-in-autoresponder/#findComment-117702 Share on other sites More sharing options...
btherl Posted November 1, 2006 Share Posted November 1, 2006 I checked the syntax, and I think you need to change to this:[code]$body = <<<EOF<html><body><br>Thank you for your submission!<br><br>Click on the image below for your confirmation!<br><br><a href="http://www.yoursite.com/thankyou.html"><img src="http://www.yoursite.com/thanks.jpg" alt="Thanks!" width="244" height="165"></a><br></body></html>EOF;[/code]The final EOF must be at the start of a line, and the beginning EOF syntax is not exactly like some other languages (perl I think allows more flexibility with the starting marker)Btw, knowing that the email was never sent and that the meta refresh doesn't display is why I knew to look at the syntax first.. otherwise I would have no idea where to start debugging. Which is why I asked all those questions :) Quote Link to comment https://forums.phpfreaks.com/topic/25775-cannot-display-a-link-or-image-with-absolute-url-in-autoresponder/#findComment-117705 Share on other sites More sharing options...
pan1138 Posted November 1, 2006 Author Share Posted November 1, 2006 Tried it, did not work.Same thing - hangs up on the HTML Quote Link to comment https://forums.phpfreaks.com/topic/25775-cannot-display-a-link-or-image-with-absolute-url-in-autoresponder/#findComment-117706 Share on other sites More sharing options...
btherl Posted November 1, 2006 Share Posted November 1, 2006 Does "hangs up on the HTML" means it doesn't send the email and doesn't display any errors?If so, you probably have another syntax error in there.Are you able to use a shell to check the syntax of your script?If not, can you set the display_errors configuration variable to true? Then any syntax errors will be shown in the browser.If there's no syntax errors, then add print statements throughout your script to see how far it gets before dying. Quote Link to comment https://forums.phpfreaks.com/topic/25775-cannot-display-a-link-or-image-with-absolute-url-in-autoresponder/#findComment-117711 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.