Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Form - PHP Mailer cannot send to @Gmail.com
    primarykey
    data
    text
    <p>We have a PHP form on our website that has worked for years. When users fill the form out in sends us the details, and sends them an email and then re-directs the user to a "thank-you" page. However, if a user puts their email address as @gmail.com the form fails to send, it doesnt show the thank-you page.</p> <p>This is really bizarre. We are using PHPMailer and validate if the form has been sent using: </p> <pre><code> if($mail-&gt;Send()) { $mailsent = true; </code></pre> <p>If a user enters @hotmail.com or at @yahoo.com everything is fine. But enter @gmail.com and $mailsent is always false.</p> <p>In this situation where does the problem lye? It seems to me that our web hosts SMTP connection to Gmail is failing. Would this seem right?</p> <p>Here is the code:</p> <pre><code>&lt;?php error_reporting(E_ALL); ini_set("display_errors", 1); $name = ''; $email = ''; $mailsent = false; $referer = ''; if(isset($_POST['name'])){ include('phpmailer/class.phpmailer.php'); $name = $_POST['name']; $email = $_POST['email']; $subject = 'Quote request from ' . $name; $body = 'A quote request has been received from a user with following details:' . "\n\n" . "Name: $name \n" . "Email: $email \n" . "----------------------------------------------------\n\n" . "Place: UK". $body .= "\n----------------------------------------------------\n\n"; $body .= "Refering: ".$referer." \n"; $mail = new PHPMailer(); $mail-&gt;Subject = $subject; $mail-&gt;From = $email; $mail-&gt;FromName = $name; $mail-&gt;Body = $body; $mail-&gt;AddAddress("dean@example.com", "Example"); if($mail-&gt;Send()) { $mailsent = true; } else { $error[] = 'There was some error. Please try later.'; } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload