Question:
how do I receive email from my website with php?
?
2011-06-07 10:23:54 UTC
I recently started a new website for my business and the contact page contains php to handle the email. My web host is hostmonster and my website directory has the default php.ini installed.

I have entered the email I would like the messages sent to as well as what is required in each field etc in the php file but I am not sure how to get it to work so that when someone clicks submit button, the message is sent right to my email account.

Also the pop up warnings when a person is filling in the required fields such as "Thank you for your message" "Numbers only" "Letters Only" do not appear.

I am fairly new to this and if someone can give me some tips on what I need to do to get everything working, please let me know!

The domain is from godaddy
Three answers:
anonymous
2011-06-08 04:25:59 UTC
You can make the email form yourself. Just follow the instructions on the web form making site you use.



Your current hosting package or service MUST allow SMTP ( http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol ) to work. Otherwise, no email can be sent.



PHP: Sending Email Tutorial (Text/HTML/Attachments): http://www.webcheatsheet.com/php/send_email_text_html_attachment.php



Use any of the below sites to make the workable form you need:



These are really good online form makers. Just follow the instructions for making it and uploading file(s).



How to Make a Slick Ajax Contact Form with jQuery and PHP: http://www.elated.com/articles/slick-ajax-contact-form-jquery-php/



Contact Form Generator: http://www.tele-pro.co.uk/scripts/contact_form/

WYSIWYG Form Maker: http://www.jotform.com/?gclid=CNKhqei1wJ4CFRQhnAod6laUqA

http://www.thesitewizard.com/wizards/feedbackform.shtml

http://www.form2email.net/

http://www.phpform.org/



http://www.thepcmanwebsite.com/form_mail.shtml

http://emailmeform.com/



www.freecontactform.com/

www.reconn.us/content/view/12/34/ (Download - Contact Us Script)

formsmarts.com/



apptools.com/phptools/forms/forms1.php

Form Service: www.mycontactform.com/

Online Free Tool, PHP Contact Form Code Generator: www.htmlbasix.com/contactform.shtml



More...
?
2011-06-07 10:29:57 UTC
I'm not going to write the script for you, if you want someone to just do it for you then I charge $25 an hour, I estimate a minimum of 2 hours and will require the $50 up front.



You can also search on Google for "php email forms" and read the instructions that come with whatever script you choose.
anonymous
2011-06-07 11:59:22 UTC
You might want to look into using what we call a "Content Management System" - where you don't have to worry about these types of things in the backend.



Check out Drupal



http://www.durpal.org



or Joomla



http://www.joomla.com



Both are amazing CMS driven websites you can have setup within 10 minute, a fully functioning site without the need to mess around with PHP.



Not to mention - expanding on the usability and applicable scenario's of said CMS is simple with the 'Modular Integration' they offer.



Otherwise, handling mail in PHP is fairly easy.















Above you can see we have created a form. the 'action' declares what to do when the 'submit' button is pressed. We indicated that we would like the form to run my_mailer.php. The 'method' tells the form what we plan to do, in our scenario we are POSTING the information, alternatively, you could "GET", but we're not "GETTING" anything, we're attempting to "POST" it so it can be sent.



//new file, called "my_mailer.php" -- contents to follow


$email =$HTTP_POST_VARS['email']

$subject =$HTTP_POST_VARS['subject']



if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)){

//bad email, invoke errors

echo "INVALID EMAIL!!";

//send them back

echo "Back";

}else if($subject == ""){

//no subject included

echo "NO SUBJECT!!";

//send them bakc to fix it

echo "Back";

}else if mail($mail, $subject, $message)){

echo "Email sent. Thank you.";



}else{

//generic error - could be the address?

echo "The Email did not send. Please Go Back and check the supplied information.";

}


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...