Page 1 of 1

PHP- email not sending

Posted: Thu Mar 29, 2012 11:38 pm
by shaik kaleem
Hello ,

I am very new to php function i never been used to it before... i want a web form on my website so that when ever the user entering the details and hit submit button, all the details filled should come to my email inbox.can any one help me to get the complete details, as i mentioned i am very new to php.... Thanks....

Re: PHP- email not sending

Posted: Fri Mar 30, 2012 1:44 am
by mc_guy
This should work...

<?php

$SendFormTo = 'Type your email id';
$Emailsubject = 'Whatever sub line you want';

$Name = $_POST['Name'];
$Email = $_POST['Email'];
$Comments = $_POST['Comments'];

$body = "

Name - $Name
Email - $Email
Comments - $Comments

";

$headers = "From: $Email";
$success = mail($SendFormTo, $Emailsubject, $body, $headers);

header( "Location: http:yourcomp.com" );

?>

Re: PHP- email not sending

Posted: Fri Mar 30, 2012 5:31 am
by social_experiment
You could also use search engines to find tutorials on the matter; you don't want a mail script that allows you form to be used as a platform from where spam is sent; field checking; possible captcha solutions are things you should look at

Re: PHP- email not sending

Posted: Fri Mar 30, 2012 6:03 pm
by phphelpme
Also, just as Social has mentioned, you really need to check that the submission is human or not because depending on your hosting provider you may have limits to how many messages get sent per minute. So if you get spammed you could end up with your account suspended on grounds of mass mailing.

This would happen because even though you are mailing everything to yourself, the systems that monitor this process do not take this into account. They just count the mail being sent via the mail() function.

Search Google for PHP FORMS
Search Google for reCaptcha etc such as http://www.google.com/recaptcha/captcha and ge to grips with it to make sure you are not subject to spam just like Social said.

Best wishes