Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

Email Not Submitting

the mail() function

Moderators: macek, egami, gesf

Email Not Submitting

Postby art4life44 » Fri Dec 09, 2011 8:00 am

Hello,
I was hoping someone could help me with my email form. I am able to fill out the form and when I click submit, I get the success message that the email has been sent, yet nothing shows up in my inbox. Am I missing some sort of setting in the PHP code? Please help! Here is the site:

http://amdesigngroup.com/contact-form/

Thank you!!
art4life44
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri Dec 09, 2011 7:20 am

Re: Email Not Submitting

Postby egami » Fri Dec 09, 2011 8:02 am

Please post your code, as a link doesn't show us whats happening in the background.
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2197
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Email Not Submitting

Postby art4life44 » Fri Dec 09, 2011 8:28 am

Oh sorry... thanks!


<?php
//start session for the captcha code, there must never be any html before session_start(), will return an error
session_start();

//Check if captcha filled in, if not abort sending the message
if(strtolower($_POST['code']) == strtolower($_SESSION['random_number'])) {

//restraints
if (!empty($_POST['name']) &&
!empty($_POST['email']) &&
!empty($_POST['number']) &&
!empty($_POST['message'])) {

$message = "
Feedback from Website, sent on ".date('d - M - Y')."

Name: ".$_POST['name']."
Email: ".$_POST['email']."
Number: ".$_POST['number']."
Company: ".$_POST['company']."

Message: ".$_POST['message']."

";


$email = "lauren@amdesigngroup.com";

$subject = "Feedback from Website";

$headers = "From: website@contact.co.za";


//mail($email, $subject, $message, $headers);

echo "true"; //if all goes smoothly 'true' is returned

} else echo "false"; //if the required fields are not filled in, 'false' is returned
} else echo "aborted"; //if captcha not correct, 'aborted' is returned
?>
art4life44
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri Dec 09, 2011 7:20 am

Re: Email Not Submitting

Postby egami » Mon Dec 12, 2011 5:26 am

remove the // from the mail comment.
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2197
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Email Not Submitting

Postby art4life44 » Mon Dec 12, 2011 6:39 am

OK, I tried removing the // but still no luck, any other ideas? Thanks!!
art4life44
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri Dec 09, 2011 7:20 am

Re: Email Not Submitting

Postby egami » Mon Dec 12, 2011 6:48 am

start with a new .php file.


simply do this.

$to = 'your-email-address@someplace.com';
$subject = 'Test-Email';
$message = 'This is a test message. Alive yes or no?';

if (mail ($to,$subject,$message)) {
echo "Sent!";
} else {
echo "FAILED!";
}
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2197
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron