S
S
sawa42016-08-17 09:19:43
Laravel
sawa4, 2016-08-17 09:19:43

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

1 answer(s)
S
sawa4, 2016-08-17
@sawa4

D' Normalization @Denormalization
sawa4:
And if before $message->attach($pathToFile); do:
\Log::info($pathToFile)
What will be there?

c3da6dcfe5374b368c88252f56f4944a.png[2016-08-17 14:53:04] local.ERROR: exception 'Swift_TransportException' with message 'Connection to ssl://smtp.gmail.com:465 Timed Out' in /var/www/mysite.com/vendor /swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:404

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question