Php 不允许使用SMTP Dreamhost的SwiftMailer发件人域?

Php 不允许使用SMTP Dreamhost的SwiftMailer发件人域?,php,email,smtp,swiftmailer,dreamhost,Php,Email,Smtp,Swiftmailer,Dreamhost,我正在尝试使用SwiftMailer和SMTP发送电子邮件。SMTP服务器是标准的Dreamhost设置。我只在使用不在dreamhost上托管的电子邮件时才会遇到问题。例如,如果我使用contact@joescotto.net作为电子邮件的发件人,我不会有任何问题,电子邮件将发送。但是,如果我使用contactjoescotto@gmail.com我将得到以下错误: 预期响应代码为250,但收到代码为“550”,消息为“不允许550 5.7.1发件人域。请阅读:D157” 我的电子邮件功能如下

我正在尝试使用SwiftMailer和SMTP发送电子邮件。SMTP服务器是标准的Dreamhost设置。我只在使用不在dreamhost上托管的电子邮件时才会遇到问题。例如,如果我使用
contact@joescotto.net
作为电子邮件的发件人,我不会有任何问题,电子邮件将发送。但是,如果我使用
contactjoescotto@gmail.com
我将得到以下错误:

预期响应代码为250,但收到代码为“550”,消息为“不允许550 5.7.1发件人域。请阅读:D157”

我的电子邮件功能如下:

/**
 * Sends an email
 * @param  string $name    Sender name
 * @param  string $subject Sender subject
 * @param  string $email   Sender email
 * @param  string $message Sender message
 * @return bool            True if sent, otherwise false
 */
public static function sendMessage($name, $subject, $email, $message) {
    // Create and setup the transport
    $transport = Swift_SmtpTransport::newInstance($GLOBALS['config']['smtp']['host'], $GLOBALS['config']['smtp']['port'])
        ->setUsername($GLOBALS['config']['smtp']['username'])
        ->setPassword($GLOBALS['config']['smtp']['password']);

    // Create the mailer using your created Transport
    $mailer = Swift_Mailer::newInstance($transport);

    // Create a message
    $message = Swift_Message::newInstance($subject)
        ->setFrom([$email => $name])
        ->setTo(['contact@joescotto.net' => 'Joe Scotto'])
        ->setBody($message);

    // Try to send the message
    if (!$mailer->send($message)) {
        return false;
    }

    // Set email timeout cookie
    setcookie("emailTimeout", true, time() + (60 * 5), '/');

    // Return true on sucessful send
    return true;
}

任何帮助都会很好,谢谢

试试看-reply@whatever-您所在的服务器&使用“发件人”地址的“答复”标题?

尝试否-reply@whatever-您所在的服务器&使用发件人地址的回复标题?

发件人地址是什么?在dreamhost上,我使用“sendmail”传输通过swift mailer发送电子邮件,EasierFrom地址是什么?在dreamhost上,我使用“sendmail”传输通过swift mailer发送电子邮件,更方便