I know this is simple but my brain is fried from trying to solve a different problem!
I'm using php's mail function to email the user. Below is my code. See the a href link, how do I get this to display as an actual link within the php?
$email=someone@example.com;
$content= "Dear Whoever,
NB: Please click <a href=\"document.pdf\" target=\"_blank\">here</a> to read and download the terms and conditions.";
mail( "$email", "Welcome", $content, "From: support@example.com");
As noted above, your code has error. It should be:
email='someone@example.com';
$content= "Dear Whoever,
NB: Please click <a href=\"document.pdf\" target=\"_blank\">here</a> to read and download the terms and conditions.";
mail( $email, "Welcome", $content, "From: support@example.com");
You would need to set the mime type to HTML in the header, and use it as a parameter in the mail() function.
// 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";
// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
Though I usually use SwiftMailer and it has other neat features.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.