Here’s the situation: I have a contact form that uses a PHP Mailer to send messages to a [email protected] address. This [email protected] address forwards all messages to my business address.
I have 4 fields users enter information in: Name, Email, Subject, Message
Here’s the issue: users who enter Gmail addresses into the Email part of the form can not send a message to me. All other email address domains work perfectly. Just not Gmail. I am not sure how to fix it. Any help would be greatly appreciated ;D Here is my code:
[php]
<?php require 'PHPMailer/PHPMailerAutoload.php'; $host = 'host'; $username = 'address'; $password = 'password'; $send = false; // Subject $subject = addslashes(strip_tags($_POST['subject'])); // Name $name = addslashes(strip_tags($_POST['name'])); // Email $email = addslashes(strip_tags($_POST['email'])); // Message $message = addslashes(strip_tags($_POST['message'])); // Services $services = ''; if ( isset($_POST['services']) AND count($_POST['services']) > 0) { $index = 1; foreach ( $_POST['services'] as $val) { $services .= ( $index == count($_POST['services'])) ? $val : $val . ', '; $index++; } } else { $services .= '-'; } // Project Class if ( isset($_POST['project_class']) AND $_POST['project_class'] <> '') { $project_class = addslashes(strip_tags($_POST['project_class'])); } else { $project_class = '-'; } $htmlmessage = <<<MESSAGE $subjectName: $name
Email: $email
Message: $message
Services: $services
Project Class: $project_class
MESSAGE; $mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = $host; $mail->Username = $username; $mail->Password = $password; $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure = 'ssl'; // sets the prefix to the servier (ssl / tls) $mail->Port = 465; // set the SMTP port for the dreamhost email server $mail->IsHTML(TRUE); $mail->From = $email; $mail->FromName = $name; // Add receive email address $mail->addAddress($username); $mail->isHTML(true); $mail->Subject = $subject; $mail->Body = $htmlmessage; // Send the message, check for errors if ( $mail->send()) { $send = true; } echo json_encode($send); [/php]