Answer the question
In order to leave comments, you need to log in
How to attach a file to an email without saving it to disk?
Tell me how to attach a file to a letter using ->attach() without saving it to disk?
There is a file which needs to be hooked to the letter. But attach only accepts the path to the saved file, how to get around this?
$pdf=new \FPDF();
$pdf->AddPage();
$pdf->Image($envelope,60,30,90,0);
Yii::$app->mailer->compose()
->setTo('@gmail.com')
->setFrom(['@gmail.com' => Yii::$app->params['senderName']])
->setReplyTo([$this->email => $this->fromPerson])
->setSubject("Ваш конверт")
->setTextBody("Вам отправил письмо {$this->fromPerson} проживающий по адресу {$this->fromPlace}.")
->setBody($this->pdf) // нужно прикрепить pdf
->send();
return true;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question