1

On my website I'm not receiving emails from form submissions. I've tried a bunch of things but can't figure out the problem. Are headers necessary? Code is below.

if (@$_POST['submitted']) {

if ($error_msg) {
    echo "<div id='textcontainer'>\n";
    foreach ($error_msg as $err) {
    echo "<li><strong>".$err."</strong></li>\n";
    }
    echo "</ul>\n";
}

    else {
    $fn_call = '<strong>First Name:</strong>';
    $fn_call2 = strip_tags($fn_call);

    $ln_call = '<strong>Last Name:</strong>';
    $ln_call2 = strip_tags($ln_call);

    $e_call = '<strong>Email:</strong>';
    $e_call2 = strip_tags($e_call);

    $p_call = '<strong>Phone:</strong>';
    $p_call2 = strip_tags($p_call);

    $pd_call = '<strong>Problem Description:</strong>';
    $pd_call2 = strip_tags($pd_call);

    $dt_call = '<strong>Date Submitted:</strong>';
    $ip_call = '<strong>IP Address:</strong>';

date_default_timezone_set('America/New_York');
$EST_Time = date('m/d/y h:i:s a', time());
$ipaddress = $_SERVER['REMOTE_ADDR'];

$destination_email="myemail@gmail.com";
$email_subject="Customer Form Submission";       
$email_body = "$fn_call2 $fname\n\n $ln_call2 $lname\n\n $e_call2 $email\n\n $p_call2 $phone\n\n $pd_call2 $problem_desc $dt_call $EST_Time\n\n $ip_call $ipaddress\n\n";

mail ($destination_email, $email_subject, $email_body);

I've been trying some things, the mail code in its current form is still not working. See below.

<?php
    if (!empty($_POST)){
if ($error_msg) {
    echo "<div id='textcontainer'>\n";
    foreach ($error_msg as $err) {
    echo "<li><strong>".$err."</strong></li>\n";
    }
    echo "</ul>\n";
}

    else {  
date_default_timezone_set('America/New_York');
$EST_Time = date('m/d/y h:i:s a', time());
$ipaddress = $_SERVER['REMOTE_ADDR'];

$destination_email="email@gmail.com";
$email_subject="Customer Form Submission";       
$email_body = "First Name: " + $fname + "\n\n" + "Last Name: " + $lname + "\n\n" +  "Email: " + $email + "\n\n" + "Phone: " + $phone + "\n\n" + "Problem Description:" + $problem_desc + "IP Address: " + $ipaddress + "\n\n" + "Date Submitted: " + $EST_Time;

mail ($destination_email, $email_subject, $email_body);

Update:

For testing purposes, I commented out the above code and added this in place, which is simple correct code that should work. But it doesn't. Should I complain to godaddy some more? What's the issue here?

$to = "myemail@gmail.com"; 
$subject = "Email from php";
$body = "Hi this is a test";

mail($to, $subject, $body);
dan
  • 21
  • 3
  • Any error messages? Any debugging steps taken? – mario Nov 23 '14 at 06:05
  • No error messages. I had it working on localhost prior to publishing it on the web. GoDaddy said it should be working but it's not. – dan Nov 23 '14 at 06:21

0 Answers0