0

Ok before you guys laugh LOLZ --> I'm not sure if this is a GMAIL issue or something I'm doing wrong but im trying to insert an email for an activation link in the body of a message.

$body = "Or click on this link: <a href=\"http://www.url.com/start/page.php?verify=true&id=".$url."&activate=".$ac."> Activate Your Account </a>" 


Ok the problem here is that my GMAIL account shows this: (which BTW is click-able and routes correctly)

Or click on this link: <a href="http://www.url.com/start/page.php?verify=true&id=f22645cff5ecfd4d3c115af5&activate=75845> Activate Your Account </a> 

What am I missing here? Is this just a gmail issue? How can i Correct this? I want it to show: Activate Your Account

6
  • 1
    Are you sending the email as an HTML email? What are the headers? Commented Sep 7, 2012 at 0:25
  • 1
    You are not sending an HTML email (or you are doing it incorrectly.). Commented Sep 7, 2012 at 0:25
  • Ahh didn't know I had to specify -- How do I send as an HTML email? Commented Sep 7, 2012 at 0:26
  • The answer to this question has the necessary headers. There are many others Commented Sep 7, 2012 at 0:27
  • @JaredFarrish that didn't change anything.. Same result Commented Sep 7, 2012 at 0:29

6 Answers 6

3

Try closing the quote at the end of your URL.

The SO syntax highlighting even showed you the issue.

Sign up to request clarification or add additional context in comments.

Comments

1
  1. Wrong Syntax,

error hould have showed you whats happening,

Parse error: syntax error, unexpected T_STRING on line x... 

2 . Send HTML mail, the Content-type header must be set to html

I made some changes and tested this, try this working script :

<?php $body = 'Or click on this link: <a href="http://www.url.com/start/page.php?verify=true&id='.$url.'&activate='.$ac.'"> Activate Your Account </a>'; // To send HTML mail, the Content-type header must be set $headers = 'From: [email protected]' . "\r\n" . $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail("[email protected]","Subject goes here",$body,$headers); ?> 

PHP Mail

bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] ) 

3 Comments

Ok i got your code to work - but adding a subject line breaks it? Whats the deal? and Its not showing my email address but my SERVER name instead... any ideas?
Just edited the code, You need to send from in the header, and Subject would be 2nd argument for mail function.
Yeah i got it working earlier but thx. I checked u reciprocate if so inclined :)
0

For sure you're missing a double quote here.

<a href="http://www.example.com/...5845> 

This shall be instead written as:

<a href="http://www.example.com/...5845"> 

Comments

0

If you didn't set the headers, this works for me. Of course you need to set your own variables.

 $sender_email = strip_tags($sender_email); $subject = "=?UTF-8?B?".base64_encode(strip_tags($title))."?="; $message = nl2br(strip_tags($message)); $headers = "From: ".$sender_email.' <'.$sender_email.'>'."\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html;\r\n"; $headers .= "\tformat=flowed;\r\n"; $headers .= "\tcharset=\"utf-8\";\r\n"; $headers .= "\treply-type=original\r\n"; $headers .= "Content-Transfer-Encoding: 8bit\r\n"; $headers .= "Reply-To: ".$sender_email."\r\n"; $body = __('sendfriend:defaultmessage') . '<br /><br/><a href="'.$link.'" title="'.$title.'" target="_blank">'.$link.'</a><br/><br />'.$message; $mail = mail($recipients, $subject, $body, $headers); 

Comments

0

Make sure to send the email as an HTML email.

$headers = "From: [email protected]\r\n"; $headers .= "Content-Type: text/html\r\n"; mail(...$headers); 

Add the $headers variable on the end of the mail function.

Comments

0

define headers in your mail function first

 $headers = 'From: [email protected]' . "\r\n" . $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.