BookSense Posted September 22, 2021 Share Posted September 22, 2021 Hi guys. I had an online email form working until my old host decided to delete most of my files. I have spent all day searching for an alternative to no avail. All I am looking for is a form that can be placed in an iframe where users can send an email from the website to a specified email address. Can anybody help me please? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/ Share on other sites More sharing options...
requinix Posted September 22, 2021 Share Posted September 22, 2021 Can't you just put the old files back? I mean, if your host "decided" to delete your files, that's a really bad thing and you ought to move to another host who won't, you know, delete your stuff. Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590236 Share on other sites More sharing options...
ginerjm Posted September 22, 2021 Share Posted September 22, 2021 (edited) Your host didn't do backups for you? Was this a free host or a paid one? And - where did you actually do your code-writing? On your own pc, no? So where are those files? This doesn't sound like something that can actually happen. Edited September 22, 2021 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590237 Share on other sites More sharing options...
BookSense Posted September 22, 2021 Author Share Posted September 22, 2021 I paid the host - they lost over 30,000 files!!! and my email form as well. Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590238 Share on other sites More sharing options...
ginerjm Posted September 22, 2021 Share Posted September 22, 2021 So where's their backup/restore process? Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590239 Share on other sites More sharing options...
BookSense Posted September 22, 2021 Author Share Posted September 22, 2021 (edited) And sorry - my PC also decided to pack up so lost all my backups here too. Not a good day!!! Edited September 22, 2021 by BookSense Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590240 Share on other sites More sharing options...
ginerjm Posted September 22, 2021 Share Posted September 22, 2021 And you don't have any backups of that either? You should get into a new hobby/business... Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590241 Share on other sites More sharing options...
BookSense Posted September 22, 2021 Author Share Posted September 22, 2021 I have a new host - redeveloped all my other front-end software but just cannot get a web to email working again Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590242 Share on other sites More sharing options...
BookSense Posted September 22, 2021 Author Share Posted September 22, 2021 It should be a simple task - downloaded loads of PHP email scripts from various sites and not one of them actually works Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590243 Share on other sites More sharing options...
BookSense Posted September 22, 2021 Author Share Posted September 22, 2021 9 minutes ago, ginerjm said: Your host didn't do backups for you? Was this a free host or a paid one? And - where did you actually do your code-writing? On your own pc, no? So where are those files? This doesn't sound like something that can actually happen. Unfortunately it does happen Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590244 Share on other sites More sharing options...
ginerjm Posted September 22, 2021 Share Posted September 22, 2021 Not buying it. Good bye Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590245 Share on other sites More sharing options...
BookSense Posted September 22, 2021 Author Share Posted September 22, 2021 Forget it. Stuff happens Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590246 Share on other sites More sharing options...
jarvis Posted September 23, 2021 Share Posted September 23, 2021 Hi @BookSense I always come here to learn and ask others for advice. I'm always asked to show my code, what I've tried, explain why things don't work, what errors I get, what debugging I've done. etc. You mentioned you've downloaded loads of email scripts but none work. Why? What errors do you get? What did you try? You didn't share anything here for others to help. If they ALL failed, then maybe it's more server related!? I get embarrassed asking for help at times, especially when I simply don't 'get it' but it's the only way to learn and sometimes I can sense the frustration in the people trying to point out the glaringly obvious. I'm constantly trying to learn and improve. It does feel despite what appears to have been a truly terrible day, you may need to try harder! You mentioned you 'redeveloped all my other front-end software ' surely that's pretty skilled, so seems odd you can't sort the form!? Below is a very simple script - it may work, it may not. Contact Page: <!doctype html> <html> <head> <meta charset="utf-8"> <title>Contact Us</title> </head> <body> <form method="post" name="contact" action="contact.php"> Your Name: <input type="text" name="name"> Email Address: <input type="text" name="email"> Message: <textarea name="message"></textarea> <input type="submit" value="Submit"> </form> <script language="JavaScript"> var validate = new Validator("contact"); validate.addValidation("name","req","Please provide your name"); validate.addValidation("email","req","Please provide your email"); validate.addValidation("email","email","Please enter a valid email address"); </script> </body> </html> contact.php $errors = ''; $myemail = 'yourname@website.com';//<-----Put Your email address here. if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) { $errors .= "\n Error: all fields are required"; } $name = $_POST['name']; $email_address = $_POST['email']; $message = $_POST['message']; if (!preg_match( "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address)) { $errors .= "\n Error: Invalid email address"; } if( empty($errors)) { $to = $myemail; $email_subject = "Contact form submission: $name"; $email_body = "You have received a new message. ". " Here are the details:\n Name: $name \n ". "Email: $email_address\n Message \n $message"; $headers = "From: $myemail\n"; $headers .= "Reply-To: $email_address"; mail($to,$email_subject,$email_body,$headers); //redirect to the 'thank you' page header('Location: thank-you.htm'); } thank-you.htm: <!doctype html> <html> <head> <meta charset="utf-8"> <title>Thank You</title> </head> <body> Thanks </body> </html> Maybe try that, if it doesn't work, try debugging it to find out why. If it's not got enough data capture fields, hopefully, it's a good starting point to develop! Quote Link to comment https://forums.phpfreaks.com/topic/313793-a-very-simple-web-to-email-form/#findComment-1590253 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.