views:

294

answers:

1

Hello.

I have this script that works ok. Trouble is that when I make Click here You cannot click the link in Thunderbird mailing program (Mozilla). If I see the source code it is okay. What gives?

public function send_mail($email='',$subject='',$text='') {
    $mail = new PHPMailer();
    $db = new Db();
    $sql = $db->query("SELECT * FROM configuration WHERE name='shopemail' OR name='shopname'");
    while($configuration = $db->fetchArray($sql)) {
     $row[$configuration['name']] = $configuration['value'];
    }
    // MIME BOUNDARY
    $mime_boundary = $data['shopname'].md5(time());
    $headers = "From: ".$row['shopname']." <".$row['shopemail'].">\n";
    $headers .= "Reply-To: ".$row['shopname']." <". $row['shopemail'].">\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
    // TEXT EMAIL PART
    $message = "--$mime_boundary\n";
    $message .= "Content-Type: text/html; charset=iso-8859-1\n";
    $message .= "Content-Transfer-Encoding: 8bit\n\n";
    $message .= $text."\n";
    // FINAL BOUNDARY
    $message .= "--$mime_boundary--\n\n";
    // SEND MAIL
    $mail_sent = @mail( $email, $subject, $message, $headers );
}
+1  A: 

Well,

The solution has been found via the comments of the OP... But still, it'd be better with an "accepted" answer, so that other people immediatly see the solution has been found...

So, quoting my own comment :

I guess $text is the HTML content ? Still, we'll probably need to see the HTML code to help (there is no generated in this code, so it'll be hard to find out why it isn't working ^^ ) ; a wild guess : is your link absolute ("example.com/blah.php";) and not relative ("/blah.php") ?

And the answer from Cudos :

Doh! made a stupid mistake: Click here missed the "http://" part

(And marking this as "community wiki", so I don't get any rep point -- wouldn't be "fair", I think)

Pascal MARTIN