0

I am trying to build a verification mail for my website, but I can't seem to get the PHPmailer to include html and php. I can get the verification mail send to the correct mail address, with the correct body, the code for that is this:

$mail->Body = 'Please verificate your account by clicking on the following link: http:localhost/confirm.php?passkey=' . $confirm_code;

Now I am trying to get the link in the mail to be an actual link, I tried this (see code below) but that didn't work

$mail->Body = 'Please verificate your account by clicking on the following link: <a href=\"http:localhost/confirm.php?passkey= . $confirm_code\">http:localhost/confirm.php?passkey=' . $confirm_code . '</a>';

I have set the PHPmailer to send emails with html:

$mail->Debugoutput = 'html';

Could anyone tell me what the problem is here?

Pimmmo
  • 57
  • 7

2 Answers2

1

You have to concatenate the link var too.

Also, within single quotes you don't need to use backslash:

$mail->Body = 'Please verificate your account by clicking on the following link: <a href="http:localhost/confirm.php?passkey='. $confirm_code.'">http:localhost/confirm.php?passkey=' . $confirm_code . '</a>';
Dimas Pante
  • 2,380
  • 19
  • 29
  • 1
    Thanks for the code, but I for it to work I also needed this code added: $mail->IsHTML(true); – Pimmmo Jan 23 '15 at 22:13
1

Setting Debugoutput has nothing to do with sending HTML - it's the error output format. You need to call isHTML() or set your content using msgHTML(). Also there is no such word as 'verificate' it's just 'verify'.

Synchro
  • 29,823
  • 14
  • 69
  • 85
  • I already figured out the ishtml (see comment above) but thanks for the correction in English, it is not my native tongue, so I still make mistakes sometimes ;) – Pimmmo Jan 24 '15 at 19:38
  • It just made you sound like George W Bush! – Synchro Jan 24 '15 at 19:40