jeff5656 Posted February 25, 2012 Share Posted February 25, 2012 I am using the mail command in php. I'm using a class call phpmailer.php. I want to mail something that contains a link. The wording of the email is stored in the database under a text field and I declare it as: $body. If I put inside the body: Dear john, here is the link: test.com then the email contains a hyperlink called test.com. But it does not work if I put this in the text: <a href='test.com'>CLICK ME</a> In the email, you can see the <a href tag and click me is just text. How do I get the email to show it like this: tes.com Quote Link to comment https://forums.phpfreaks.com/topic/257770-emailing-a-link-using-tags/ Share on other sites More sharing options...
MarPlo Posted February 25, 2012 Share Posted February 25, 2012 Hi, If you use phpmailer class, use the MsgHTML() method to send the email, like this: $mail->MsgHTML($body); // to send with HTML tags Quote Link to comment https://forums.phpfreaks.com/topic/257770-emailing-a-link-using-tags/#findComment-1321190 Share on other sites More sharing options...
jeff5656 Posted February 25, 2012 Author Share Posted February 25, 2012 I think it might be a different class, because here's how they want me to handle the body of the text: $mail->Body = "Dear Dr. $pd_lname, \n $body "; Quote Link to comment https://forums.phpfreaks.com/topic/257770-emailing-a-link-using-tags/#findComment-1321255 Share on other sites More sharing options...
jeff5656 Posted February 25, 2012 Author Share Posted February 25, 2012 I figured it out. I had to use stripslashes after I retrieved it from the database. And the class called for it to be used like this: $mail->IsHTML(true); Quote Link to comment https://forums.phpfreaks.com/topic/257770-emailing-a-link-using-tags/#findComment-1321261 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.