Symfony 1.4 'ın Cron Jobs PHP SwiftMailer kullanabilir?

0 Cevap php

I am using Symfony 1.4 with Propel as ORM. i have configured web server schedulers to trigger a mailing function at every 1Hour. To send mails i am using PHP Swift mailer class, and not the symfony's inbuild Swiftmailer(default in 1.3,1.4). But while using it is giving me error.. as "Catchable fatal error: Argument 1 passed to Swift_Transport_EsmtpTransport::__construct() must implement interface Swift_Transport_IoBuffer, none given in /home/msconslt/sfprojects/test/lib/mailClasses/classes/Swift/Transport/EsmtpTransport.php on line 64". The code that i am using...

  require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php');
  $configuration =ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);
  // Remove the following lines if you don't use the database layer
  $databaseManager = new sfDatabaseManager($configuration);

 //Create the Transport
 $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, "ssl")
 ->setUsername('myid@gmail.com')
 ->setPassword('mypassword')
 ;

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

 //Create a message
 $message = Swift_Message::newInstance("Test Mail")
 ->setFrom(array('myid@gmail.com' => 'Harry'))
->setTo(array('someid@gmail.com'))
->setBody('<html>'.
 '<head></head>'.
 '<body> <span>Dear, </span><br/> Hi there..</body>'.
 '</html>',
 'text/html'
 );

 $mailer->send($message);

Cron işleri ile posta göndermek için başka bir yolu var mı?

0 Cevap