1
使用SWIFT郵件在我的PHP代碼,我使用的這個,但我得到的錯誤我怎樣才能在symfony的
foo_bundle.listener.comment:
class: xxx\Listener\CupleListener
arguments: [@mailer]
class CupleListener
{
protected $mailer;
public function __construct(Swift_Mailer $mailer)
{
$this->mailer = $mailer;
}
public function onCenterEvent(CupleEvent $event)
{
$center = $event->getcenter();
$message = \Swift_Message::newInstance()
->setSubject('New comment posted on ' . $post->getTitle())
->setFrom('[email protected]')
->setTo('xxxxxxxxxx')
->setBody("Hey, somebody left a new comment on a post you're subscribed to! It says: " . $comment->getBody());
$this->mailer->send($message);
}
}
這是給錯誤
此外,我不知道名稱空間頂部包括哪些類別
你得到的錯誤是什麼? – 2012-07-26 03:21:44
它表示預計Mybundle \ Swif_mailer的實例,但Swiftmailer的實例給出 – user825904 2012-07-26 03:31:18