Hi there,

I have recently added a login system to a site i'm doing and i'm stuck on something thats getting quite annoying!

The user registers then gets an email with an link to follow to activate the account.

The problem is the $link in the email is just text and not a hyperlink.

// Send the email:
$link = 	BASE_URL . 'activate.php?x=' . urlencode($e) . "&y=$a";			
$message = "<p align'center'>Hello, $fn</p><p>To Continue registration please follow this link</p>
";
$message .= "\n\n";
$message  .= $link;



$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: admin<admin@mysite.co.uk>\r\n";
$headers .= "Return-path: admin<admin@mysite.co.uk.co.uk>\r\n";
				
				mail($trimmed['email'], 'Registration Confirmation', $message, $headers);
				
				// Finish the page:

Any help would be great!

Thanks...

Recommended Answers

All 14 Replies

What does echo $link; output?

Your problem is BASE_URL. It isn't in a usable format. It needs to look like a variable.

@ Buddy, The output is a randomly generated activation code used to activate the login.

@Khess, What would you suggest in place of base url ?

Cheers Guys..

What does BASE_URL equal? Can you put in that line of code?

I need to see the actual code line, sorry.

Try changing all instances of BASE_URL to $BASE_URL and see if that works.

Never mind, I found the answer...

define("base_url", "http://foo.com");

$filepath = base_url."/foo.gif";

Try:

define ("base_url", "http://mysite.com/login");
$link = 	base_url . 'activate.php?x=' . urlencode($e) . "&y=$a";

Try:

define ("base_url", "http://mysite.com/login");
$link = 	base_url . 'activate.php?x=' . urlencode($e) . "&y=$a";

This is the setup i pretty much have, what i need is $link to be shown as a hyperlink in the email, i just tried the method above and it shows the full url but only as text, not a link!


Cheers...

You've got to make it a link:

$link = "<a href='".BASE_URL . 'activate.php?x=' . urlencode($e) . "&y=$a'>".BASE_URL."</a>";

You've got to make it a link:

$link = "<a href='".BASE_URL . 'activate.php?x=' . urlencode($e) . "&y=$a'>".BASE_URL."</a>";

Thanks a million mate, I was so busy looking at the code that i forgot about adding html to it......there is a lesson there...


Thanks again for al your help guys

Cheers...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.