Php Symfony 1.4:电子邮件配置
我正在尝试从运行Symfony 1.4的服务器发送电子邮件 我有通常的基本邮件服务器设置,服务器名为Php Symfony 1.4:电子邮件配置,php,email,symfony-1.4,Php,Email,Symfony 1.4,我正在尝试从运行Symfony 1.4的服务器发送电子邮件 我有通常的基本邮件服务器设置,服务器名为mail.tixxit.com.au和端口25。我在我的工厂.xml中有此配置: mailer: param: transport: class: Swift_SmtpTransport param: host: mail.tixxit.com.au port: 25
mail.tixxit.com.au
和端口25
。我在我的工厂.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
。我已经在我的本地机器和我的web服务器上试过了,得到了相同的结果
我错过了什么?要真正做到这一点,我需要什么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;
}