ericthomson Posted January 6, 2012 Share Posted January 6, 2012 I am trying to use the php mail function and want to include links to a dynamic page, so I need to know how to do this... Something like: $id=$_POST['id']; $mailto="[email protected]"; $mailsub="Subject"; $mailhead="From: [email protected]"; $mailbody="Your comment has been posted. You may view it by <a href='domain.com/page.php?id=".$id."'>clicking here</a>."; mail($mailto, $mailsub, $mailbody, $mailhead); I know this is not correct but I'm trying to figure out the actual way to do this... Quote Link to comment https://forums.phpfreaks.com/topic/254518-using-linkshtml-in-php-mail-function/ Share on other sites More sharing options...
Psycho Posted January 6, 2012 Share Posted January 6, 2012 The problem you are facing is probably due to the fact that they email is being sent as plain text. You have two options that come to mind: 1. Just add the url in the output (i.e. not an anchor tag). The email readers (Outlook, gmail, etc.) *may* actually convert the URLs to clickable links on their own. This would be very easy to test. 2. To make your own clickable hyperlinks using an anchor tag you will want to send the emails as HTML emails. There are a lot of things you need to do when doing this. I suggest either looking up some tutorials or find a good class to handle this. Quote Link to comment https://forums.phpfreaks.com/topic/254518-using-linkshtml-in-php-mail-function/#findComment-1305062 Share on other sites More sharing options...
ericthomson Posted January 6, 2012 Author Share Posted January 6, 2012 Yeah, I don't need links that bad... Quote Link to comment https://forums.phpfreaks.com/topic/254518-using-linkshtml-in-php-mail-function/#findComment-1305065 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.