Jump to content

Recommended Posts

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: do_not_reply@xxxxx.xxx \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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.