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....
PHP- email not sending
Moderator: General Moderators
Re: PHP- email not sending
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" );
?>
<?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" );
?>
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: PHP- email not sending
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
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: PHP- email not sending
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
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