laravel mail attachment queue code example
Example 1: email send using queue with attachment laravel
<?php
namespacde App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class SendMailWithAttachment extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
public function __construct()
{
}
public function build()
{
return $this->to('[email protected]')
->attach(storage_path('app/1569316022.jpg'))
->markdown('mail_example');
}
}
Example 2: email send using queue with attachment laravel
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
d{
use Queueable, SerializesModels;
public function __construct()
{
}
public function build()
{
return $this->to('[email protected]')
->attach(storage_path('app/1569316022.jpg'))
->markdown('mail_example');
}
}