Pastor.Shaun
New Member
- Messages
- 1
- Reaction score
- 0
- Points
- 0
I have created a simple contact form on my new site and it is not sending the email.
I am not new to PHP or server side email scripts, I have created dozens of them. I also have a very strong technical background.
I have searched the forums, FAQ and found no answers. I have also created several test scripts and used some of the scripts found in the Forums... none of them work.
Interesting is that I can telnet to the mail server on port 25 and webmail works from my cPanel, all of which are on STARKA.
Have I missed something in my cPanel setup to get the script to work?
The last test script I used is below (which was taken from the forums).
Thank you in advance,
Pastor Shaun
Rahab Ministries
========================================================
<?php
function spamcheck($field)
{
//filter_var() sanitizes the e-mail
//address using FILTER_SANITIZE_EMAIL
$field=filter_var($field, FILTER_SANITIZE_EMAIL);
//filter_var() validates the e-mail
//address using FILTER_VALIDATE_EMAIL
if(filter_var($field, FILTER_VALIDATE_EMAIL))
{
return TRUE;
}
else
{
return FALSE;
}
}
if (isset($_REQUEST['email']))
{//if "email" is filled out, proceed
//check if the email address is invalid
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==FALSE)
{
echo "Try Again";
}
else
{//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("contact@rahabministries.x10.mx", "Subject: $subject",
$message, "From: $email" );
echo "Thank you, your email has been sent.";
}
}
else
{//if "email" is not filled out, display the form
echo "<div style='padding:5px;'><form method='post' action='test.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' value='Send' />
</form></div>";
}
?>
---------- Post added at 02:18 PM ---------- Previous post was at 07:53 AM ----------
I created a work around to log into the SMTP server. While the form works the issue is not resolved as I would like to understand why the PHP mail() function does not work.
I am not new to PHP or server side email scripts, I have created dozens of them. I also have a very strong technical background.
I have searched the forums, FAQ and found no answers. I have also created several test scripts and used some of the scripts found in the Forums... none of them work.
Interesting is that I can telnet to the mail server on port 25 and webmail works from my cPanel, all of which are on STARKA.
Have I missed something in my cPanel setup to get the script to work?
The last test script I used is below (which was taken from the forums).
Thank you in advance,
Pastor Shaun
Rahab Ministries
========================================================
<?php
function spamcheck($field)
{
//filter_var() sanitizes the e-mail
//address using FILTER_SANITIZE_EMAIL
$field=filter_var($field, FILTER_SANITIZE_EMAIL);
//filter_var() validates the e-mail
//address using FILTER_VALIDATE_EMAIL
if(filter_var($field, FILTER_VALIDATE_EMAIL))
{
return TRUE;
}
else
{
return FALSE;
}
}
if (isset($_REQUEST['email']))
{//if "email" is filled out, proceed
//check if the email address is invalid
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==FALSE)
{
echo "Try Again";
}
else
{//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("contact@rahabministries.x10.mx", "Subject: $subject",
$message, "From: $email" );
echo "Thank you, your email has been sent.";
}
}
else
{//if "email" is not filled out, display the form
echo "<div style='padding:5px;'><form method='post' action='test.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' value='Send' />
</form></div>";
}
?>
---------- Post added at 02:18 PM ---------- Previous post was at 07:53 AM ----------
I created a work around to log into the SMTP server. While the form works the issue is not resolved as I would like to understand why the PHP mail() function does not work.