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

SwiftMailer sender domain not allowed using SMTP Dreamhost?

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

Expected response code 250 but got code "550", with message "550 5.7.1 Sender domain not allowed. Please read: http://dhurl.org/20b 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;
}

任何帮助都会很棒,谢谢!

尝试 no-reply@whatever-server-you-are-on 并使用 reply-to header 作为发件人地址?