I'm trying to send mails via task, that i would like to run per batch. In the task-execute()-function, i tried the follwing:
$mailer = $this->getMailer();
$message = $mailer->compose()
->setFrom(sfConfig::get('app_emailadresse'))
->setTo('mail@supermail.com')
->setSubject('Subject')
->setBody($content);
$this->getMailer()->send($message);
(i also tried many other versions e.g. with sfContext::getInstance()->getMailer(), but then i got "the default context does not exist)
In factories.yml, I added the following:
all:
mailer:
class: sfMailer
param:
logging: %SF_LOGGING_ENABLED%
charset: %SF_CHARSET%
delivery_strategy: realtime
transport:
class: Swift_SmtpTransport
param:
host: mycustom.smtp.com //of course, i set the data of my provider
port: 587
encryption: ssl
username: myusername //of course, i set the data of my provider
password: mypassword //of course, i set the data of my provider
But on the command-line, after running my task, i always got "Connection could not be established with localhost"
This is confusing, because in the factory.yml i told the mailer to use MY settings, haven't I ??
Of course i cleared cache etc. and i read different examples and tutorials but still i don't got it
Could someone help me?
