Symfony 1.4:电子邮件配置


Symfony 1.4: email configuration

我正试图简单地从运行Symfony 1.4的服务器发送一封电子邮件。

我有通常的基本邮件服务器设置,服务器名称为mail.tixxit.com.au,端口为25。我的factories.xml:中有此配置

  mailer:
    param:
      transport:
        class: Swift_SmtpTransport
          param:
            host:       mail.tixxit.com.au
            port:       25
            encryption: ssl # Not sure on this but have tried "tls" too
            username:   myaccount@tixxit.com.au
            password:   mypassword

然后,在我的一个操作中,我有一个基本的发送代码:

        $this->getMailer()->composeAndSend(
            "myaccount@tixxit.com.au",
            "anotheraccount@gmail.com",
            "Message title",
            "Message content"
        );

根据我在其他文档中提到的内容,这应该是我在PHP中使用Symfony从服务器发送电子邮件所需要做的全部工作,但这不起作用。发送代码没有给出任何错误,我可以很好地从我的web服务器访问mail.tixxit.com.au服务器,我的凭据绝对正确,我已经在我的电子邮件托管公司的支持下确认,这应该可以工作,不需要他们进行任何配置。

但是我的邮件没有寄出。我在factories.xml中尝试了很多不同的设置,但都不起作用。它似乎在发送,但anotheraccount@gmail.com从未收到任何消息。我已经在我的本地机器和网络服务器上尝试过了,得到了同样的结果。

我在这里错过了什么?我需要什么Symfony/PHP/server/mail帐户设置才能真正做到这一点?在Symfony东西之前,是否有其他基本配置应该设置,以允许我发送?

我找不到答案。似乎什么都不起作用。我放弃并使用了自然Swift类,例如:

        $transport = Swift_SmtpTransport::newInstance('mail.tixxit.com.au', 25)
            ->setUsername('myaccount@tixxit.com.au')->setPassword('mypassword');
        $mailer = Swift_Mailer::newInstance($transport);
        $message = Swift_Message::newInstance("Message title")
            ->setFrom(array('myaccount@tixxit.com.au' => 'App'))
            ->setTo(array('anotheraccount@gmail.com'));
        $message->setBody("Message content.");
        if ($mailer->send($message, $errors)) {
            $success = true;
        }