0
votes

When i send CSV attachment in mail, showing base64 format in mail response

Mail::send('emails.waitingTime', [], function ($message) use ($email, $subject, $fileName) {
    $message->to($email)->subject($subject)->attach(URL::asset('/'. $fileName))->setContentType('text/csv');
});

Showing in mail

--_=_swift_1574330801_b65df1604759f4a281a1fd4aab1b757b_=_ Content-Type: text/csv; name=unifonmitel.csv Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=unifonmitel.csv TGlzdGVkLCBBdmcgd2FpdGluZyB0aW1lCkt1bmRlc3VwcG9ydCwgNi43NjU2MjUKU2FsZ3NzdXBw b3J0LCA1LjUKSVQgU3VwcG9ydCwgMi4yCg== --_=_swift_1574330801_b65df1604759f4a281a1fd4aab1b757b_=_--

3
Does your .csv file is proper?Prashant Deshmukh.....
yes i also converter base64 data for testing Its showing same csv file dataPirta Matharu
What is value of $fileName ?Prashant Deshmukh.....
unifonmitel.csvPirta Matharu

3 Answers

1
votes

Change your mail function

Mail::send('welcome', [], function ($message) use ($email, $subject, $fileName) {
    $message->to($email)->subject($subject)->attach(URL::asset('/'. $fileName))->setContentType('text/csv');
});
0
votes
Mail::send('emails.waitingTime', [], function ($message) use ($email, $subject, $fileName) {
    $message->to($email)->subject($subject)->attach(URL::asset('/'. $fileName))->setContentType('text/csv');
});

waitingTime.blade

Add something in blade file
-1
votes

May be this will help you

$subject = 'Email Subject';
Mail::send('emails.notification', ['message' => $message], function ($mail) use ($userEmail, $subject) {
    $mail->from('[email protected]', 'Domain Name');
    $mail->to($userEmail)->subject($subject);
});