giorg
6 months ago

email attachment

Posted 6 months ago by giorg

Hi, I'm writing an email this way in my controller:

Mail::send('emails.smartchange', ['manufacturer' => $manufacturer, 'subject' => $subject], function ($message) use ($manufacturer, $subject) {
                $message->from($manufacturer->pec_indirizzo, $manufacturer->nome);
                $message->subject($subject);
                $message->to('[email protected]');
                $message->attach(public_path() . '/storage/labels/ETICHETTE300518-876327252.txt', [
                    'as' => 'test.txt',
                    'mime' => 'text/plain'
                ]);

the email is sent but instead of the attachment, I see this in the body:

--_=swift_1551190146_2f993e7d31446485d662d662e585fc2d=_ Content-Type: text/plain; name=armando.txt Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=armando.txt UVAwNTE2MTM4N0E7U1RTMjIyMjcNClFQMDUxNjEyODJHO1NUUzIyMjI2DQpRUDA1MTYxNDEyTDtT VFMyMjIyOA0KUVAwNTE2MTQxM0s7U1RTMjIyMjk= --_=swift_1551190146_2f993e7d31446485d662d662e585fc2d=_--

what am I doing wrong? Thanks a lot

Please sign in or create an account to participate in this conversation.