站点联系表单不起作用 - 使用Bluehost和Gsuite

时间:2017-08-27 19:20:06

标签: php email gmail bluehost gsuite

我知道这是一个经常被问到的问题,但我已经完成了其他线程中的步骤,但它似乎没有帮助。一直在努力奋斗这一周,真的很感激帮助!

以下是关键部分:

  1. mail()返回true
  2. 电子邮件未到达
  3. 我发送的是site@mysite.com,它在Bluehost和Gsuite上设置了匹配的密码
  4. Bluehost坚持其所有SMTP设置/ MX记录都是正确的
  5. GSuite电子邮件记录日志显示我的网站队列中没有电子邮件(他们坚持认为这是Bluehost的错误)
  6. error_reporting(E_ALL)不显示任何内容
  7. HTML将所有变量正确发布到PHP
  8. 这两个电子邮件帐户(发送和接收)都可以发送和接收电子邮件
  9. 我认为SMTP设置可能有误,但Bluehost支持说他们不能直接更改这些。详情如下......

    PHP代码

    <?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 = 'support@mysite.com';
        $from = 'site@mysite.com'; //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: site@mysite.com
    
    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
    

0 个答案:

没有答案