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 Link to comment https://forums.phpfreaks.com/topic/229348-inserting-url/ 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. Link to comment https://forums.phpfreaks.com/topic/229348-inserting-url/#findComment-1181712 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('[email protected]','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" ;} } Link to comment https://forums.phpfreaks.com/topic/229348-inserting-url/#findComment-1181863 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.