Steps to send mail using sendgrid mailer function in yii2? -


i trying mail using sendgrid in yii 2 doesn't seem work.can 1 tell me steps of sendgrid in yii2 .

you can use https://github.com/bryglen/yii2-sendgrid#yii-2-bryglen-sendgrid

installation:

composer require --prefer-dist bryglen/yii2-sendgrid "*" 

common/config/main.php

'components' => [     ...     'sendgrid' => [         'class' => 'bryglen\sendgrid\mailer',         'username' => 'your_user_name',         'password' => 'your password here',         //'viewpath' => '@app/views/mail', // view path here     ],     ... ], 

to send email, may use following code:

$sendgrid = yii::$app->sendgrid; $message = $sendgrid->compose('contact/html', ['contactform' => $form]); $message->setfrom('from@domain.com')     ->setto($form->email)     ->setsubject($form->subject)     ->send($sendgrid); 

Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -