everurssantosh Posted September 1, 2008 Share Posted September 1, 2008 Hi, I am sending a link in mail where the receipents will click to visit the site. Unfortunately, the links are disabled. I am only getting the text "Click Here" in blue text but the link is disabled. I have tested this for all mail servers link Gmail, Hotmail and Yahoomail. Below is the Code for your reference. $return_html.= "<a href='.$customer_url.'new_user_sign_up_verification.php?conf_code=".$confirm_code."&email=".$str_Email."&lang=".$str_lang."'>". $ADMIN_MAIL4 ."</a>"; Please help me to enable the link in the mail sent to the users. Thank you. Santosh Quote Link to comment https://forums.phpfreaks.com/topic/122233-sending-links-in-mail/ Share on other sites More sharing options...
JonnoTheDev Posted September 1, 2008 Share Posted September 1, 2008 Are your mail headers correct? text/html Quote Link to comment https://forums.phpfreaks.com/topic/122233-sending-links-in-mail/#findComment-631102 Share on other sites More sharing options...
PFMaBiSmAd Posted September 1, 2008 Share Posted September 1, 2008 The [/url] is caused by the forum software when people don't bother to post code using the forum's code tags. Does $customer_url contain http://somedomain.com/ ? so that the url is an absolute fully qualified URL? Also, is the email being sent with the proper headers and formatting so that it is a HTML email? Quote Link to comment https://forums.phpfreaks.com/topic/122233-sending-links-in-mail/#findComment-631107 Share on other sites More sharing options...
everurssantosh Posted September 1, 2008 Author Share Posted September 1, 2008 Hi Thanks for the response. Yes, My URL is fully qualified and tested also. Infact, I am sending the same URL below the mail to give an option to the user, in case the Link is not working, they can copy and paste the URL from the mail in the IE. I have shown the code for your reference. The content type is : text/html. Please help to find a solution to this problem $headers = "From: customersupport@test.com\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $boundary = uniqid("HTMLDEMO"); $headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n"; $body = "--$boundary\r\n" . "Content-Type: text/html; charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n"; $body .= "--$boundary\r\n" . "Content-Type: text/html; charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n"; $body .= chunk_split(base64_encode($return_html)); Thank you Santosh Quote Link to comment https://forums.phpfreaks.com/topic/122233-sending-links-in-mail/#findComment-631112 Share on other sites More sharing options...
blinky001 Posted September 1, 2008 Share Posted September 1, 2008 Are you using a multipart e-mail structure? This is an example (without validation) to give you a reference point: <?php $subject = 'Whatever you like'; $headers = 'From: "'.$name.'" <'.$email.'>'."\n"; $headers .= 'Reply-To: '.$your_email."\n"; $headers .= 'Delivered-To: '.$email."\n"; $headers .= 'Return-Path: '.$your_email."\n"; $headers .= 'Date: '.date('r')."\n"; $headers .= 'X-Mailer: PHP '.phpversion()."\n"; $headers .= 'X-Sender: '.$your_email."\n"; $headers .= 'X-Priority: 3'."\n"; $headers .= 'X-MSMail-Priority: Normal'."\n"; $headers .= 'MIME-Version: 1.0'."\n"; # Plain/HTML e-mail $boundary = '==MPBoundary_'.mb_substr(sha1(time()), 0, ; $headers .= 'Content-Type: multipart/alternative; boundary="'.$boundary.'"'."\n\n"; $content = '--'.$boundary."\n"; $content .= 'Content-type: text/plain; charset=utf-8'."\n"; $content .= 'Content-Transfer-Encoding: 8bit'."\n\n"; $content .= $html_email; $content .= '--'.$boundary."\n"; $content .= 'Content-type: text/html; charset=utf-8'."\n"; $content .= 'Content-Transfer-Encoding: 8bit'."\n\n"; $content .= $plain_email; $content .= '--'.$boundary.'--'."\n"; mail($to, $subject, $content, $headers); ?> Also make sure that you close your href attribute's value in double quotes (some clients don't like singles): <?php $return_html.= '<a href="'.$customer_url.'new_user_sign_up_verification.php?conf_code='.$confirm_code.'&email='.$str_Email.'&lang='.$str_lang.'">'.$ADMIN_MAIL4.'</a>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/122233-sending-links-in-mail/#findComment-631116 Share on other sites More sharing options...
PFMaBiSmAd Posted September 1, 2008 Share Posted September 1, 2008 In the original post, the quoting is totally messed up (starting with a single-quote is being used where a double-quote should be.) Quote Link to comment https://forums.phpfreaks.com/topic/122233-sending-links-in-mail/#findComment-631125 Share on other sites More sharing options...
everurssantosh Posted September 1, 2008 Author Share Posted September 1, 2008 Thanks to everybody for supporting me to solve this problem. Replacing single quote with double quote solved the problem.. Thanks a lot. Santosh Quote Link to comment https://forums.phpfreaks.com/topic/122233-sending-links-in-mail/#findComment-631130 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.