I'm developing on Symfony3. I have a command which allows to send a e-mail the first day of each month. When I was working on local, the command worked fine. Last week, I deploy my project in a "shared OVH Hosting", and when I execute the command, I get this error :
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: mkdir(): Permission denied
This is my swiftmailer configuration : (config.yml) :
swiftmailer:
transport: "%mailer_transport%"
auth_mode: "%mailer_auth_mode%"
host: "%mailer_host%"
encryption: "%mailer_encryption%"
port: "%mailer_port%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
And parameters.yml :
parameters:
mailer_transport: smtp
mailer_auth_mode: login
mailer_host: ns0.ovh.net
mailer_encryption: null
mailer_port: 587
mailer_user: mymail@mydomain.fr
mailer_password: mypass
And finally, my code sending an email (working in local) :
$pdf->Output("billing/FA-".$value->getDateRefresh()->format('Y-m')."-".$user->getId().".pdf",'F');
$message = \Swift_Message::newInstance('Votre fature du '.$value->getDateRefresh()->format('m-Y'))
->setFrom(array("mymail@mydomain.fr" => 'Name'))
->setTo($user->getEmail())
->setBody('Voici ci joint votre relevé CONVERSEO du '.$value->getDateRefresh()->format('m-Y'), 'text/html');
$attachment = \Swift_Attachment::fromPath("billing/FA-".$value->getDateRefresh()->format('Y-m')."-".$user->getId().".pdf");
$message->attach($attachment);
$transport = \Swift_MailTransport::newInstance();
$mailer = \Swift_Mailer::newInstance($transport);
$this->getContainer()->get('mailer')->send($message);
Thanks you for your answers !