I am developing a web application in Yii2. I have attached a file while sending the email. But after attaching the file in email I am facing this error.
My code for sending email with attachment goes like this
Yii::$app->mailer->compose()
->setFrom('sender email')
->setTo('reciever email')
->setSubject('test')
->setHtmlBody('test')
->attach('path of attachment file')
->send();
I am really facing a big problem please help.
According to this link http://www.yiiframework.com/doc-2.0/guide-tutorial-mailing.html#file-attachment , the attach() method expects the filename (string) as parameter. To fix your code: