Symfony / Swiftmailer:警告:mkdir():权限被拒绝

时间:2017-06-14 13:16:10

标签: php html symfony email swiftmailer

我正在开发Symfony3。我有一个命令,允许在每个月的第一天发送电子邮件。当我在当地工作时,命令工作正常。 上周,我在“共享OVH主机”中部署我的项目,当我执行命令时,我收到此错误:

  [Symfony\Component\Debug\Exception\ContextErrorException]
  Warning: mkdir(): Permission denied

这是我的swiftmailer配置:( 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 }

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

最后,我的代码发送了一封电子邮件(在当地工作):

  $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);

感谢您的回答!

0 个答案:

没有答案
相关问题