shadiadiph Posted December 8, 2008 Share Posted December 8, 2008 I am having problems maybe I am going about it the wrong way I ca get people to sign up ok and it adds the data to my sql datbase fine but the email it generates doesn't work properly links in the email go nowhere and do not work. It is a confirmation email which will link to a php page which will change a value in my database that page will be easy for me to do but this is FREAKING me out maybe I am just too tired. Here is my code any help will be much appreciated. <? $name = stripslashes($_POST["name"]); $email = stripslashes($_POST["email"]); $to = "$email"; $subject = "$name Please confirm subscription to our newsletter"; $MsgHeader = "From: Asia Pacific Advisors<[email protected].> \n"; $MsgHeader .= "MIME-Version: 1.0\n"; $MsgHeader .= "Content-type: text/html; charset=iso-8859-1"; $MsgBody = " <html> <head> <title>HTML message</title> </head> <body> </form> <table> <input type='hidden' name='name' value='$name' /> <input type='hidden' name='name' value='$email' /> <tr><td align='left'><img src='http://www.website.com/pix/apalogo.jpg'></td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Dear $name</font></td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Your subscription to our newsletter at website.com. has been received</font></td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Please <a href='http:/www.website.com/newsletter_confirm.php?eid=<?=urlencode('$email')?>&nid=<?=urlencode('$name')?>&Sid=<?=urlencode('Y')?>'>click here</a> to activate your subscription.</font></td></tr> <tr><td> </td></tr> <tr><td> </td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'> <tr><td> </td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>This message has been automatically generated please do not reply to this email.</font></td></tr> <tr><td> </td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 11px' style='font-color: #336699' style='font-family: Tahoma, Arial'>This message, and any attachments, is intended only for the use of the individual or entity to which it is addressed, and may contain confidential, proprietary and/or privileged information that is exempt from disclosure under applicable law which is not waived or lost by any transmission failure. If the reader of this message is not the intended recipient or its employee, or agent responsible for delivering the message to the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this communication and any attachments hereto is strictly prohibited. If you have received this communication in error, please destroy this message. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of another person or entity. </font></td></tr> </table> </form> </body> </html>"; mail($to, $subject, $MsgBody, $MsgHeader); ?> Link to comment https://forums.phpfreaks.com/topic/136033-solved-urlencode-embedded-into-emails/ Share on other sites More sharing options...
trq Posted December 8, 2008 Share Posted December 8, 2008 Your already within php so lines like.... <a href='http:/www.website.com/newsletter_confirm.php?eid=<?=urlencode('$email')?> Don't make alot of sense. ps: Don't use short <? ?> tags. They will not work on all servers. Link to comment https://forums.phpfreaks.com/topic/136033-solved-urlencode-embedded-into-emails/#findComment-709266 Share on other sites More sharing options...
shadiadiph Posted December 8, 2008 Author Share Posted December 8, 2008 hi i removed the <? ?> tags but it still isn't working email sends and recieves fine but the click here link doesn't do anything.? Link to comment https://forums.phpfreaks.com/topic/136033-solved-urlencode-embedded-into-emails/#findComment-709279 Share on other sites More sharing options...
Kieran Menor Posted December 8, 2008 Share Posted December 8, 2008 Do not forget that you are inside a string. Try something like this: <a href='http:/www.website.com/newsletter_confirm.php?eid=" . urlencode($email) . "&nid=" . urlencode($name) . "&Sid=" . urlencode('Y') ."'> Link to comment https://forums.phpfreaks.com/topic/136033-solved-urlencode-embedded-into-emails/#findComment-709284 Share on other sites More sharing options...
shadiadiph Posted December 8, 2008 Author Share Posted December 8, 2008 sorry that doesn't work either link just doesn't do anything? Acts like it has no values to it? Link to comment https://forums.phpfreaks.com/topic/136033-solved-urlencode-embedded-into-emails/#findComment-709290 Share on other sites More sharing options...
trq Posted December 8, 2008 Share Posted December 8, 2008 Post your current code. Link to comment https://forums.phpfreaks.com/topic/136033-solved-urlencode-embedded-into-emails/#findComment-709297 Share on other sites More sharing options...
shadiadiph Posted December 8, 2008 Author Share Posted December 8, 2008 Hi here is the whole php script the first part works fine and writes to the database i left off the bottom part below this which is all html the problem is the email part. This is the submit data form from another page where the user enteres his name and email. <? session_start(); error_reporting(apa); ?> <?PHP include("secure/p/global/connection.php"); include("secure/p/global/mail.class.php"); error_reporting(7); $name = stripslashes($_POST["name"]); $email = stripslashes($_POST["email"]); $checkuser ="select intUserID from tblnewsletteruserdetails where email='$email'"; $temps = $DB_site->query($checkuser); $total = $DB_site->num_rows($temps); if ($total>0) { ?> <script> alert("This email address is already registered. Please try a defferent email address or contact us.") history.back() </script> <? } else { $insertsql = " insert into tblnewsletteruserdetails (name, email,subscribed,dtAddedOn) values ('".addslashes($name)."', '".addslashes($email)."', '".addslashes('N')."','".date("y-m-d h:m:s")."')"; $DB_site->query($insertsql); $userid = mysql_insert_id(); ?> <? $to = "[email protected]"; $subject = "Newsletter SignUp On APA"; $MsgHeader = "From: APA <[email protected]> \n"; $MsgHeader .= "MIME-Version: 1.0\n"; $MsgHeader .= "Content-type: text/html; charset=iso-8859-1"; $MsgBody = " <html> <head> <title>HTML message</title> </head> <body> <table> <tr><td align='left'><img src='http://www.website.com/pix/apalogo.jpg'></td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Dear Administrator</font></td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>$name with email $email has signed up for the newsletter at website.com</font></td></tr> <tr><td> </td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'> Regards</font></td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'> APA Website Monitor</font></td></tr> <tr><td> </td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 11px' style='font-color: #336699' style='font-family: Tahoma, Arial'>This message, and any attachments, is intended only for the use of the individual or entity to which it is addressed, and may contain confidential, proprietary and/or privileged information that is exempt from disclosure under applicable law which is not waived or lost by any transmission failure. If the reader of this message is not the intended recipient or its employee, or agent responsible for delivering the message to the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this communication and any attachments hereto is strictly prohibited. If you have received this communication in error, please destroy this message. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of another person or entity. </font></td></tr> </table> </body> </html>"; mail($to, $subject, $MsgBody, $MsgHeader); ?> <? $name = stripslashes($_POST["name"]); $email = stripslashes($_POST["email"]); $to = "$email"; $subject = "$name Please confirm subscription to our newsletter"; $MsgHeader = "From: APA<[email protected]> \n"; $MsgHeader .= "MIME-Version: 1.0\n"; $MsgHeader .= "Content-type: text/html; charset=iso-8859-1"; $MsgBody = " <html> <head> <title>HTML message</title> </head> <body> </form> <table> <input type='hidden' name='name' value='$name' /> <input type='hidden' name='name' value='$email' /> <tr><td align='left'><img src='http://www.website.com/pix/apalogo.jpg'></td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Dear $name</font></td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Your subscription to our newsletter at website.com has been received</font></td></tr> <tr><td> </td></tr> <tr><td><tr><td> </td></tr><a href="http:/www.website.com/newsletter_confirm.php?eid=" . urlencode($email) . "&nid=" . urlencode($name) . "&sid=" . urlencode('Y') .">Click here</a> </font></td></tr><tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>If you have received this email by mistake we apologise and please <a>click here</a> to delete your details from our database.</font></td></tr> <tr><td> </td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'> Best Regards</font></td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'> APA Team</font></td></tr> <tr><td> </td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>This message has been automatically generated please do not reply to this email.</font></td></tr> <tr><td> </td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 11px' style='font-color: #336699' style='font-family: Tahoma, Arial'>This message, and any attachments, is intended only for the use of the individual or entity to which it is addressed, and may contain confidential, proprietary and/or privileged information that is exempt from disclosure under applicable law which is not waived or lost by any transmission failure. If the reader of this message is not the intended recipient or its employee, or agent responsible for delivering the message to the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this communication and any attachments hereto is strictly prohibited. If you have received this communication in error, please destroy this message. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of another person or entity. </font></td></tr> </table> </form> </body> </html>"; mail($to, $subject, $MsgBody, $MsgHeader); ?> Link to comment https://forums.phpfreaks.com/topic/136033-solved-urlencode-embedded-into-emails/#findComment-709306 Share on other sites More sharing options...
shadiadiph Posted December 9, 2008 Author Share Posted December 9, 2008 I must have been too tired yesterday here is the solution for it it was so simple got it all working now. <? $to = "$email"; $subject = "$name Please Confirm Your Newsletter Signup on Website Name"; $MsgHeader = "From: Website Name <[email protected]> \n"; $MsgHeader .= "MIME-Version: 1.0\n"; $MsgHeader .= "Content-type: text/html; charset=iso-8859-1"; $MsgBody = " <html> <head> <title>HTML message</title> </head> <body> <table> <tr><td align='left'><img src='http://www.website.com/pix/apalogo.jpg'></td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Dear $name,</font></td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>To confirm your newslwtter subscription at website.com</font></td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Please <a href='http://www.website.com/newsletter_confirm.php?eid=$email&nid=Y&act=activate' 'target_new' >click here</a> to validate.</font></td></tr> <tr><td> </td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'> Regards</font></td></tr> <tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'> Website Team</font></td></tr> <tr><td> </td></tr> <tr><td> </td></tr> <tr><td><font style='font-size: 11px' style='font-color: #336699' style='font-family: Tahoma, Arial'>This message, and any attachments, is intended only for the use of the individual or entity to which it is addressed, and may contain confidential, proprietary and/or privileged information that is exempt from disclosure under applicable law which is not waived or lost by any transmission failure. If the reader of this message is not the intended recipient or its employee, or agent responsible for delivering the message to the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this communication and any attachments hereto is strictly prohibited. If you have received this communication in error, please destroy this message. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of another person or entity. </font></td></tr> </table> </body> </html>"; mail($to, $subject, $MsgBody, $MsgHeader); ?> Link to comment https://forums.phpfreaks.com/topic/136033-solved-urlencode-embedded-into-emails/#findComment-710068 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.