stublackett Posted June 30, 2008 Share Posted June 30, 2008 Hi, I've got a PHP Contact Form working no worries, But what I'd like it to do is make it so that the $email address that was posted by the form is a link to create a new mail as in the HTML Code "mailto:blabla@blabla.com" At the moment the form is producing this.... Contact Details for Test are : E-Mail Address : test@test.co.uk Contact Phone Number : test Address : Test Message : Test Message How do I make that "mailto:test@test.co.uk" ?? The E-Mail client (If needed) is MS Outlook 2003 I also see that this site has picked it up as an E-Mail address, But outlook isnt Current PHP Code is : <?php ini_set("sendmail_from", " bookings@alnwicklodge.com"); //$to = "bookings@alnwicklodge.com"; $to = "stuartblackett@fantasyprints.co.uk"; $subject = "Alnwick Lodge Contact"; $name = $_POST["name"]; $email = $_POST["email"]; $phone = $_POST['phone']; $fax = $_POST['fax']; $address = $_POST['address']; $address2 = $_POST['address2']; $postcode = $_POST['postcode']; $message = $_POST['message']; $messagesent = "Alnwick Lodge Website Query -------------------------------------------------------------------------------------------------------------------------------------------------------------- Contact Details for $name are : E-Mail Address : $email Contact Phone Number : $phone Address : $address $address2 $postcode Message : $message -------------------------------------------------------------------------------------------------------------------------------------------------------------- "; $from = $_POST["email"]; $headers = "Message From: $from"; mail($to,$subject,$messagesent,$headers); echo "Your message has been sent to us, we will be in contact shortly. thank you."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/112550-mail-form-making-it-mailto-user/ Share on other sites More sharing options...
Lamez Posted June 30, 2008 Share Posted June 30, 2008 just make a link like so <a href="mailto:<?php echo $email; ?>"><?php echo $email ?></a> Quote Link to comment https://forums.phpfreaks.com/topic/112550-mail-form-making-it-mailto-user/#findComment-577999 Share on other sites More sharing options...
stublackett Posted June 30, 2008 Author Share Posted June 30, 2008 just make a link like so <a href="mailto:<?php echo $email; ?>"><?php echo $email ?></a> The forms just erroring out and as my hosting have switched off PHP Errors I cant see the reason why I thought that would have been the answer aswell... Code (That is erroring) is now : <?php ini_set("sendmail_from", " bookings@alnwicklodge.com"); //$to = "bookings@alnwicklodge.com"; $to = "stuartblackett@fantasyprints.co.uk"; $subject = "Alnwick Lodge Contact"; $name = $_POST["name"]; $email = $_POST["email"]; $phone = $_POST['phone']; $fax = $_POST['fax']; $address = $_POST['address']; $address2 = $_POST['address2']; $postcode = $_POST['postcode']; $message = $_POST['message']; $messagesent = "Alnwick Lodge Website Query -------------------------------------------------------------------------------------------------------------------------------------------------------------- Contact Details for $name are : E-Mail Address : <a href="mailto:<?php echo $email; ?>"><?php echo $email ?></a> Contact Phone Number : $phone Address : $address $address2 $postcode Message : $message -------------------------------------------------------------------------------------------------------------------------------------------------------------- "; $from = $_POST["email"]; $headers = "Message From: $from"; mail($to,$subject,$messagesent,$headers); echo "Your message has been sent to us, we will be in contact shortly. thank you."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/112550-mail-form-making-it-mailto-user/#findComment-578008 Share on other sites More sharing options...
MasterACE14 Posted June 30, 2008 Share Posted June 30, 2008 <?php echo '<a href='mailto:' . $email . ''>' . $email' . '</a>'; try that Quote Link to comment https://forums.phpfreaks.com/topic/112550-mail-form-making-it-mailto-user/#findComment-578012 Share on other sites More sharing options...
stublackett Posted June 30, 2008 Author Share Posted June 30, 2008 Still no joy Do you think its something to do with the way my information is layed out? <?php ini_set("sendmail_from", " bookings@alnwicklodge.com"); //$to = "bookings@alnwicklodge.com"; $to = "stuartblackett@fantasyprints.co.uk"; $subject = "Alnwick Lodge Contact"; $name = $_POST["name"]; $email = $_POST["email"]; $phone = $_POST['phone']; $fax = $_POST['fax']; $address = $_POST['address']; $address2 = $_POST['address2']; $postcode = $_POST['postcode']; $message = $_POST['message']; $messagesent = "Alnwick Lodge Website Query -------------------------------------------------------------------------------------------------------------------------------------------------------------- Contact Details for $name are : E-Mail Address :<?php echo '<a href="mailto:$email">$email</a>'; Contact Phone Number : $phone Address : $address $address2 $postcode Message : $message -------------------------------------------------------------------------------------------------------------------------------------------------------------- "; $from = $_POST["email"]; $headers = "Message From: $from"; mail($to,$subject,$messagesent,$headers); echo "Your message has been sent to us, we will be in contact shortly. thank you."; ?> I've put in what was suggested, I also put it in with the close ?> PHP Tag, But that also didnt work, So I've left it to show what I've got so far Is it worth trying to set $email as a seperate variable? As in : $respondto = <a href="mailto:$email"> or something of that sorts? Quote Link to comment https://forums.phpfreaks.com/topic/112550-mail-form-making-it-mailto-user/#findComment-578014 Share on other sites More sharing options...
MasterACE14 Posted June 30, 2008 Share Posted June 30, 2008 try this: <?php ini_set("sendmail_from", " bookings@alnwicklodge.com"); //$to = "bookings@alnwicklodge.com"; $to = "stuartblackett@fantasyprints.co.uk"; $subject = "Alnwick Lodge Contact"; $name = $_POST["name"]; $email = $_POST["email"]; $phone = $_POST['phone']; $fax = $_POST['fax']; $address = $_POST['address']; $address2 = $_POST['address2']; $postcode = $_POST['postcode']; $message = $_POST['message']; $messagesent = "Alnwick Lodge Website Query -------------------------------------------------------------------------------------------------------------------------------------------------------------- Contact Details for $name are : E-Mail Address : <a href='mailto : $email'>$email</a> Contact Phone Number : $phone Address : $address $address2 $postcode Message : $message -------------------------------------------------------------------------------------------------------------------------------------------------------------- "; $from = $_POST["email"]; $headers = "Message From: $from"; mail($to, $subject, $messagesent, $headers); echo "Your message has been sent to us, we will be in contact shortly. thank you."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/112550-mail-form-making-it-mailto-user/#findComment-578018 Share on other sites More sharing options...
stublackett Posted June 30, 2008 Author Share Posted June 30, 2008 Hmmm, The form went through But the E-Mail result was this : Contact Details for Test are : E-Mail Address : <a href="mailto:$email">$email</a> Contact Phone Number : 01289334495 Address : Berwick Upon Tweed test TD15 1TB Message : Test Message Quote Link to comment https://forums.phpfreaks.com/topic/112550-mail-form-making-it-mailto-user/#findComment-578030 Share on other sites More sharing options...
MasterACE14 Posted June 30, 2008 Share Posted June 30, 2008 try this: <?php ini_set("sendmail_from", " bookings@alnwicklodge.com"); //$to = "bookings@alnwicklodge.com"; $to = "stuartblackett@fantasyprints.co.uk"; $subject = "Alnwick Lodge Contact"; $name = $_POST["name"]; $email = $_POST["email"]; $phone = $_POST['phone']; $fax = $_POST['fax']; $address = $_POST['address']; $address2 = $_POST['address2']; $postcode = $_POST['postcode']; $message = $_POST['message']; $messagesent = "Alnwick Lodge Website Query"; $messagesent .= "-----------------------------------------------------------"; $messagesent .= "------------------------------------------------------------"; $messagesent .= "---------------------------------------<br>"; $messagesent .= "Contact Details for " . $name . " are :<br>"; $messagesent .= "E-Mail Address : <a href='mailto :" . $email . "'>" . $email . "</a><br>"; $messagesent .= "Contact Phone Number : " . $phone . "<br>"; $messagesent .= "Address : " . $address . $address2 . $postcode . "<br>"; $messagesent .= "Message : " . $message . "<br>"; $messagesent .= "--------------------------------------------------------"; $messagesent .= "---------------------------------------------------------"; $messagesent .= "-------------------------------------------"; $from = $_POST["email"]; $headers = "Message From: $from"; mail($to, $subject, $messagesent, $headers); echo "Your message has been sent to us, we will be in contact shortly. thank you."; ?> see if that works. Quote Link to comment https://forums.phpfreaks.com/topic/112550-mail-form-making-it-mailto-user/#findComment-578087 Share on other sites More sharing options...
stublackett Posted June 30, 2008 Author Share Posted June 30, 2008 Still no joy, I'm afraid Its pulling through the HTML Tags in the E-Mail This is what the response was : Alnwick Lodge Website Query--------------------------------------------------------------------------------------------------------------------------------------------------------------<br>Contact Details for Test are :<br>E-Mail Address : <a href='mailto :stuartblackett@fantasyprints.co.uk'>stuartblackett@fantasyprints.co.uk</a><br>Contact Phone Number : test<br>Address : Berwick Upon TweedHartlepoolTD15 1TB<br>Message : Test Message<br>------------------------------------------------------------------------------------------------------------------------------------------------------------ Quote Link to comment https://forums.phpfreaks.com/topic/112550-mail-form-making-it-mailto-user/#findComment-578161 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.