salevan / mailgun-smtp-transport
This component provides SMTP transport for http://mailgun.com service. Use it together with Swift_Mailer.
dev-master
2017-04-22 07:34 UTC
Requires
- php: >=5.4.0
- mailgun/mailgun-php: ~1.7.2
- swiftmailer/swiftmailer: ~5.0
This package is auto-updated.
Last update: 2024-12-29 04:48:01 UTC
README
Install
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require --prefer-dist salevan/mailgun-smtp-transport "dev-master"
or add
"salevan/mailgun-smtp-transport": "dev-master"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code:
In configuration file
'components' => [
'mailer' => [
'class' => '\yii\swiftmailer\MailerMailer',
'transport' => [
'class' => '\salevan\mailgun\SmtpTransport',
'mailgunDomain' => '<Domain Name>',
'privateApiKey' => '<Private API Key>',
],
],
Sending images to Johny
\Yii::$app->mailer
->compose()
->setFrom('me@nomail.com')
->setTo('john.doe@nomail.com')
->setSubject('Message to Johny')
->setTextBody('Hello, Johny! Take a look at our party pics :)')
->attach('/image-1.jpeg')
->attach('/image-2.jpeg')
->send();
License
The BSD License (BSD). Please see License File for more information.