daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest May 16th, 2018 493 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. parameters:
  2.     mailer_transport: smtp
  3.     mailer_host: smtp.yandex.ru
  4.     mailer_port: 465
  5.     mailer_user: info@mydomain.ru
  6.     mailer_password: mypassword
  7.     mailer_encryption: ssl
  8.     mailer_auth_mode: login
  9.    
  10. imports:
  11.     - { resource: parameters.yml }
  12.  
  13. swiftmailer:
  14.     transport:   %mailer_transport%
  15.     host:        %mailer_host%
  16.     port:        %mailer_port%
  17.     username:    %mailer_user%
  18.     password:    %mailer_password%
  19.     encryption:  %mailer_encryption%
  20.     auth_mode:   %mailer_auth_mode%
  21.    
  22. try {
  23.     $message = Swift_Message::newInstance()
  24.     ->setSubject('New message')
  25.     ->setFrom('info@mydomain.ru')
  26.     ->setTo('info@mydomain.ru')
  27.     ->setBody("Message");
  28.     if(!$this->mailer->send($message, $failures)) {
  29.         return var_export($failures, true);
  30.     }
  31. } catch(Swift_SwiftException $se) {
  32.     return $se->getMessage();
  33. } catch(Exception $e) {
  34.     return $e->getMessage();
  35. }
RAW Paste Data
Top