Answer the question
In order to leave comments, you need to log in
How to form pathToFile when sending Laravel 5.2 mail?
Hello!
Guys help out if you use the code below to send mail, everything works locally.
$pathToFile = '/var/www/mysite.com/public/'.$this->getFileName($id);
Mail::later($timeSend, 'emails.queued_email', ['text' => $text], function ($message) use ($user, $title, $senderName, $pathToFile) {
$message->from( '[email protected]', $senderName);
$message->to($user->email)->subject($title);
$message->attach($pathToFile);
});
From the code, you can understand that before sending to the bed, the Laravel jobs queue table. Everything works locally. There is a path to the attached file in payload table jobs. But on the server it breaks off and is empty with some extra tags, I tried all the methods known to mine.
Maybe someone came across?
Local: "pathToFile\";s:53:\"\/var\/www\/mysite.com\/public\/149379992_images.jpg\";}s:7:\"binding\";N;s: 5:\"scope\";s:43:\"App\\Http\\Controllers\\MyController\";s:8:\"isStatic\";b:0;}}"}}
on server:
" pathToFile\";s:96:\"\/var\/www\/mysite.com\/public\/>\n
if you print
print_r($pathToFile)
itself,
you can see that the file name is there,
Answer the question
In order to leave comments, you need to log in
D' Normalization @Denormalization
sawa4:
And if before $message->attach($pathToFile); do:
\Log::info($pathToFile)
What will be there?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question