You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
458B

  1. <?php
  2. namespace common\helpers;
  3. use Yii;
  4. class Mail {
  5. public static function send($email, $subject, $view, $data) {
  6. $mail = Yii::$app->mailer->compose(
  7. [ 'html' => $view.'-html',
  8. 'text' => $view.'-text'
  9. ],
  10. $data)
  11. ->setTo($email)
  12. ->setFrom(['contact@laboiteapain.net' => 'La boîte à pain'])
  13. ->setSubject('[La boîte à pain] '.$subject)
  14. ->send();
  15. }
  16. }