lundi 7 septembre 2020

Sending Email with CSV attached

I have problem when I try to send an email with Mail::queue instead of Mail::send

I generate a CSV with League\Csv\Writer:

 $csv = $this->csvGenerator->generate(array_merge($translatedLead, $translatedProperty));

and then I send it:

Mail::send(new LeadSubmittedEmail($lead, $csv, $this->everhomeRecipients, $token));

Inside email I have:

  return $this->from($this->listingNoReply)
        ->subject("Everhome App Listing Request #{$this->lead->id}")
        ->attachData($this->csv, 'lead.csv', ['mime' => 'text/csv'])
        ->to($this->recipients)
        ->view('emails.withSellerLead.leadSubmitted');

This works fine, but if a change Mail::send to Mail::queue:

  Mail::queue(new LeadSubmittedEmail($lead, $csv, $this->everhomeRecipients, $token));

That fails and the error is:

enter image description here

If I comment the attach line inside email, the Mail::queue works ok, but I need to send the email in background



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire