bluehost服务器中的wp_mail无法设置发件人


wp_mail in bluehost server the sender cannot be set

我的wordpress站点中有一个函数,它正在工作。

function wp_send_email_shipping_confirmation( $args ){
    $content   =  send_email_shipped_confirmation( $args );
    $headers[] = 'MIME-Version: 1.0' . "'r'n";
    $headers[] = 'Content-type: text/html; charset=iso-8859-1' . "'r'n";
    $headers[] = "X-Mailer: PHP 'r'n";
    $headers[] = 'From: Wristband Creation Team <no-reply@' . $_SERVER[HTTP_HOST] . '>' . "'r'n";
    $mail = wp_mail( $args['email'], 'Your Wristbands Has Shipped Out', $content, $headers );
}

在我的本地服务器(mamppro)中,我可以在gmail上收到它,发件人是no-reply@mydomain.com这是有效的。

但是当我把它上传到我的主机(Bluehost)上时,除了发件人之外,电子邮件功能运行良好,它看起来像是(myhostID)@box421@bluehost.com而不是no-reply@mydomain.com

托管提供商不允许您以这种方式发送电子邮件。

如果你真的想从这个帐户(no-reply@mydomain.com)发送电子邮件,你应该在你的域中创建SMTP帐户,并使用SMTP插件而不是wp-mail功能通过它发送邮件。