user2515907
user2515907

Reputation: 35

embed link in php mail function

Im trying to embed an

<a href="http://www.google.com/">Google</a>

for example. In the email however it shows all the html code. I think this might be for security reasons to avoid phising scams such as getting people to visit links they do not intend to. This is the best method i can think of as I am passing sensitive informations and just want the user to see the link as just the word 'Google'.

Note: google is being used here as an example only.

Upvotes: 0

Views: 1196

Answers (2)

Pankucins
Pankucins

Reputation: 1720

Are you setting the correct headers?
Straight from php.net

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

See more, here, Example #4 about sending html email.

Upvotes: 1

Andr&#233; Dion
Andr&#233; Dion

Reputation: 21708

Take a look at Example #4 in the PHP documentation for mail

In particular, this part:

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

Upvotes: 1

Related Questions