Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. SwiftMailer Extension for Yii 2
  2. ===============================
  3. This extension provides a [SwiftMailer](http://swiftmailer.org/) mail solution for [Yii framework 2.0](http://www.yiiframework.com).
  4. For license information check the [LICENSE](LICENSE.md)-file.
  5. [![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-swiftmailer/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-swiftmailer)
  6. [![Total Downloads](https://poser.pugx.org/yiisoft/yii2-swiftmailer/downloads.png)](https://packagist.org/packages/yiisoft/yii2-swiftmailer)
  7. [![Build Status](https://travis-ci.org/yiisoft/yii2-swiftmailer.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-swiftmailer)
  8. Installation
  9. ------------
  10. The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
  11. Either run
  12. ```
  13. php composer.phar require --prefer-dist yiisoft/yii2-swiftmailer
  14. ```
  15. or add
  16. ```json
  17. "yiisoft/yii2-swiftmailer": "~2.0.0"
  18. ```
  19. to the require section of your composer.json.
  20. Usage
  21. -----
  22. To use this extension, simply add the following code in your application configuration:
  23. ```php
  24. return [
  25. //....
  26. 'components' => [
  27. 'mailer' => [
  28. 'class' => 'yii\swiftmailer\Mailer',
  29. ],
  30. ],
  31. ];
  32. ```
  33. You can then send an email as follows:
  34. ```php
  35. Yii::$app->mailer->compose('contact/html')
  36. ->setFrom('from@domain.com')
  37. ->setTo($form->email)
  38. ->setSubject($form->subject)
  39. ->send();
  40. ```
  41. For further instructions refer to the [related section in the Yii Definitive Guide](http://www.yiiframework.com/doc-2.0/guide-tutorial-mailing.html).