Donovan Posted January 17, 2008 Share Posted January 17, 2008 I have an email form mailer notifing a user if they is a waiting question. I can't seem to get the $link to display in the email as a a link. It just has the url displayed as all text. I cobbled this together from several sources. First from my notify () function. while ($row = $db->sql_fetchrow($sql)) { $to = $row['email']; $title = $row['title']; $lastname = $row['last_name']; $message = $row['comment_text']; $headers .= "From: do_not_reply\nReply-To: [email protected] \r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $subject = "A question is waiting"; $link = 'http://www.test.edu/xxxx/admin/login.php'; if(strlen($template)==0) { // Get the welcome email body from saved .html file if(!$fp = fopen($CONF_PATH."/xxxxx/template/emailquestion.tpl", "r")) { //file open failed, create error routine here Print ("File open failed very badly!"); exit; } while (!feof($fp)) { $send_body .= fgets($fp, 100); } fclose($fp); if ($count > 1) { $template = $send_body; } } else { $send_body = $template; } $send_body = eregi_replace("__lastname__", $lastname, $send_body); $send_body = eregi_replace("__title__", $title, $send_body); $send_body = eregi_replace("__message__", $message, $send_body); $send_body = eregi_replace("__link__", $link, $send_body); //echo"$send_body"; mail($to, $subject, $send_body, $headers); } } This is passed to a template... emailquestion.tpl. Example: <table width="100%"> <tr><td>The title of the question is: __title__ </td></tr> <br /><br /> <tr><td>The contents of the question is: <quote> __message__ </quote></td></tr> <br /><br /><br /> <tr><td>Click on the following link to go to the system and sign in with your account login and password.</td></tr> <br /> <tr><td>__link__</td></tr> </table> __link__ is displayed as http://www.test.edu/xxxx/admin/login.php but is not a link to click on. It is just text. I would rather have it as a proper <a href=" whatever </a> in the email. I have tried different browser based email clients Link to comment https://forums.phpfreaks.com/topic/86508-php-email-link/ Share on other sites More sharing options...
mr_mind Posted January 17, 2008 Share Posted January 17, 2008 put <html> and <body> at the beggining of the email and then just do normal HTML. Be sure to end the html and body tags Link to comment https://forums.phpfreaks.com/topic/86508-php-email-link/#findComment-442048 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.