Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Confirmation Email not showing up in GMail

Enthusiast ,
Jan 16, 2013 Jan 16, 2013

I created an Email form that does two things: populates a mysql db and sends a confirmation email to the person who filled out the form. It works great except for one thing: the confirmation email is not showing up in gmail. When I send it to Outlook accounts or Hotmail and Yahoo, the confirmation arrives without a problem. I'm wondering why is it not working in gmail? Have any of you run into to this problem?

Here is the relevant code:

$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

if (function_exists('nukeMagicQuotes')) {

  nukeMagicQuotes();

  }

// process the email

if (array_key_exists('send', $_POST)) {

          $to = $_REQUEST['email'];

          $subject = 'Registration Form';

          // expected fields

          $expected = array('first_name', 'last_name', 'medtech_id', 'job_title', 'company', 'city', 'state', 'email', 'phone', 'contact_me');

          // required fields

          $required = array('first_name', 'last_name', 'job_title', 'company', 'city', 'state', 'email', 'phone');

          // empty array for any missing fields

          $missing = array();

          // assume that there is nothing suspect

  $suspect = false;

  // create a pattern to locate suspect phrases

  $pattern = '/Content-Type:|Bcc:|Cc:/i';

  // function to check for suspect phrases

  function isSuspect($val, $pattern, &$suspect) {

    // if the variable is an array, loop through each element

          // and pass it recursively back to the same function

          if (is_array($val)) {

      foreach ($val as $item) {

              isSuspect($item, $pattern, $suspect);

              }

            }

    else {

      // if one of the suspect phrases is found, set Boolean to true

            if (preg_match($pattern, $val)) {

        $suspect = true;

              }

            }

    }

  // check the $_POST array and any sub-arrays for suspect content

  isSuspect($_POST, $pattern, $suspect);

  if ($suspect) {

    $mailSent = false;

          unset($missing);

          }

  else {

    // process the $_POST variables

    foreach ($_POST as $key => $value) {

      // assign to temporary variable and strip whitespace if not an array

      $temp = is_array($value) ? $value : trim($value);

            // if empty and required, add to $missing array

            if (empty($temp) && in_array($key, $required)) {

              array_push($missing, $key);

              }

            // otherwise, assign to a variable of the same name as $key

            elseif (in_array($key, $expected)) {

              ${$key} = $temp;

              }

            }

          }

            // go ahead only if not suspect and all required fields OK

            if (!$suspect && empty($missing)) {

          // build the message

          $message = 'Sample Message: Hello! You are registered!';

          $message = wordwrap($message, 70);

          $additionalHeaders = 'From: Registration Form on Web Site';

          if (!empty($email)) {

            $additionalHeaders .= "\r\nReply-To: $email";

            }

          $mailSent = mail($to, $subject, $message, $additionalHeaders);

          if ($mailSent) {

                    }

          }

}

TOPICS
Server side applications
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 16, 2013 Jan 16, 2013

I've never seen or heard of that before.

Is there any chance they're getting caught by some kind of spam or junk mail filters?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 16, 2013 Jan 16, 2013

Jon,

You may be responding to my originally post which I edited. The only email app I am having difficulty with is gmail. I looked in the Spam folder and the confirmation emails are not making it into Gmail.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 16, 2013 Jan 16, 2013
LATEST

After conducting some google-fu, it seems Gmail themselves could be blocking email from your server for a few different reasons.

Here's a link that had some ideas that could help you...

http://stackoverflow.com/questions/859345/php-mail-not-showing-up-at-gmail-but-shows-up-at-hotmail-a...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines