I have read the highly upvoted SO answers regarding PHP's mail() function and how to debug it. However, my client currently has a shared hosting plan with DreamHost, and I don't have access to his DH account or the host server, so I can't debug (or am finding it extremely difficult to debug) my PHP's mail function.
mail() is returning true, but the mail is never sent. Having read those answers, I know that I have to either edit the php.ini, reconfigure some settings, or install/change some software. Unfortunately, I have very limited (read: no) access to the server.
How should/can I debug the php? Should I try contacting DH customer support? Am I overlooking something?
Also, I have no idea how to work the error reporting. Am I doing this right? (This is my first time with PHP; I'm a Java dev)
For reference:
PHP:
`$errors = '';
$proceed = True;
error_reporting(E_ALL);
ini_set('display_errors', '1');
$myemail = 'myemail@hotmail.com';//I've Tried Hotmail and Gmail
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
$proceed = False;
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];
if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
$email_address))
{
$errors .= "\n Error: Invalid email address";
$proceed = False;
}`
$mailNotFailure = False;
if($proceed)
{
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: $name \n ".
"Email: $email_address\n Message \n $message";
$headers = "From: $myemail\n";
$headers .= "Reply-To: $email_address \n";
$mailNotFailure = mail($to,$email_subject,$email_body,$headers);
phpinfo();
//redirect to the 'thank you' page
}
else
{
//header('Location: contact.html');
}
if ($mailNotFailure)
{
//header('Location: index.html');
}
else
{
//header('Location: contact.html');
}`
And the phpinfo() can be found here.
Also, I apologize for the PHP code formatting . This is the first time it's given me a rough time. I had to include the single script as two blocks. Please excuse that.