Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/embed return error #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jerram
Copy link

@jerram jerram commented Sep 12, 2018

Update README with template, attachment and embedded images example

Fix issue where embedding an image returns the temp name of the file,
not the $message

$message = Yii::$app->mailgun->compose(['html' =>'welcome-html'])
->setSubject('Welcome)
->setFrom('No Reply [email protected]')
->attach(Yii::getAlias('@common').'/mail/Tweety-bird.jpg')
->setTo($this->email)
->embed(Yii::getAlias('@common')
.'/mail/daffy_duck-1048.jpg', ['fileName'=>'daffy_duck.jpg']);

Error: Call to a member function getTo() on string in
/opt/composer/vendor/yiisoft/yii2/mail/BaseMailer.php:254
Stack trace:
yii\mail\BaseMailer->send('mailgunuCYkdH')

Fix issue where embedding an image returns the temp name of the file,
not the $message

$message = Yii::$app->mailgun->compose(['html' =>'welcome-html'])
              ->setSubject('Welcome)
              ->setFrom('No Reply <[email protected]>')
              ->attach(Yii::getAlias('@common').'/mail/Tweety-bird.jpg')
              ->setTo($this->email)
              ->embed(Yii::getAlias('@common')
         .'/mail/daffy_duck-1048.jpg', ['fileName'=>'daffy_duck.jpg']);

Error: Call to a member function getTo() on string in
/opt/composer/vendor/yiisoft/yii2/mail/BaseMailer.php:254
Stack trace:
yii\mail\BaseMailer->send('mailgunuCYkdH')
$message = \Yii::$app->mailer->compose(['html' =>'welcome-html']) #
->setSubject('test subject')
->setFrom('[email protected]')
->setHtmlBody('test body')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What the point of using setHtmlBody() if you're passing the html view file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants