narjis Posted March 2, 2011 Share Posted March 2, 2011 How can I insert a url in the body of an mail such that when the user clicks on it return the url string Quote Link to comment Share on other sites More sharing options...
gizmola Posted March 2, 2011 Share Posted March 2, 2011 If you provide an html format body with the email then you handle a url like any webpage --- via an anchor tag. Whether or not the email client will support html is entirely controlled by the email client -- email is not a web browser. With that said, most email clients will support simple html, and they also tend to support recognizing that url's which start with http:// should be converted into links. Quote Link to comment Share on other sites More sharing options...
narjis Posted March 2, 2011 Author Share Posted March 2, 2011 Here's my code of function sending email. In the $urtext I am sendinding a hyperlink and want the $token to return in another function in register.php. Can I call a function from register.php? How? function send_mail($name,$email,$location,$interests) { $token = rand(); $urtext = "Please click on the following link for your registration to be complete <a href=http://localhost/PHPFAQProject/register.php?t=$token>Click Here </a>"; if ((!isset($name))||(!isset($email))) { //checking for blank input echo "<b> Please check you have not enetered the name or the email address</b>"; } $user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+'; $domain = '(??:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.?)+'; $ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}'; $ipv6 = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}'; //checking for e-mauil validity if (preg_match("/^$user@($domain|(\[($ipv4|$ipv6)\]))$/", $email)) { mail('narjisfatima@yahoo.com','feed back',$urtext); echo " <html> <head><title>Email example</title> </head> <body> <p>Your text has ben sent. Check your mail</p> </body> </html>";} else{ echo "$name<br>"; echo "$email" ; echo "Please input valid email" ;} } Quote Link to comment 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.