I know this is a question that's been asked a lot, but I've been through the steps in the other threads and it hasn't seem to help. Been struggling with this for a week and would really appreciate help!
Here are the key pieces:
- mail() returns true
- The emails are not arriving
- I'm sending from [email protected] which is setup on both Bluehost and Gsuite with matching passwords
- Bluehost is adamant all their SMTP settings/MX records are correct
- GSuite email record logs show no emails in the queue from my site (and they're adamant it's Bluehost's fault)
- error_reporting(E_ALL) shows nothing
- HTML posts all variables correctly to PHP
- Both email accounts (sending and received) can both send and receive emails
I think the SMTP settings may be wrong, but Bluehost support is saying they can't directly change these. Details below...
PHP CODE
<?php
//ERROR REPORTING
//error_reporting(E_ALL);
//ini_set('display_errors', '1');
//POST VALUES
$name=$_POST['name'];
$business=$_POST['business_name'];
$email=$_POST['email_address'];
$subject='[CONTACT PAGE] '
.strtoupper($_POST['subject'])
.' request from $name'
.' ($business)';
// The above variables confirmed to all POST
$message = '[name] '.$name.'\n'
.'[business] '.$business.'\n'
.'[email] '.$email.'\n\n'
.'[subject] '.$subject.'\n'
.$_POST['message'];
$to = '[email protected]';
$from = '[email protected]'; //Email set up on Gsuite
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= 'From: '.$from;
if (mail($to, $subject, $message, $headers)) {
$location='Location: ./contact-thanks.php';
} else {
$location='Location: ./error';
}
header($location);
die();
?>
MX RECORDS
priority host record points to ttl action
1 @ aspmx.l.google.com 14400 edit delete
5 @ alt1.aspmx.l.google.com 14400 edit delete
5 @ alt2.aspmx.l.google.com 14400 edit delete
10 @ alt3.aspmx.l.google.com 14400 edit delete
10 @ alt4.aspmx.l.google.com 14400 edit delete
BLUEHOST EMAIL CONFIGURATION
Email Settings
Mail Server Username: [email protected]
Standard (without SSL)
Incoming Mail Server: mail.mysite.com
Supported Ports: 143 (IMAP), 110 (POP3)
Outgoing Mail Server: mail.mysite.com
Supported Port: 26 (server requires authentication)
Private (with SSL)
Incoming Mail Server: mail.mysite.com
Supported Ports: 993 (IMAP), 995 (POP3)
Outgoing Mail Server: mail.mysite.com (SSL)
Supported Port: 465 (server requires authentication)
Supported Incoming Mail Protocols: POP3, IMAP
Supported Outgoing Mail Protocols: SMTP