Jump to content

Sending links in mail


everurssantosh

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/122233-sending-links-in-mail/
Share on other sites

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?

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: [email protected]\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

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>';
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.