Maybe rewrite sending in controller to set To address explicitly?
Mail::to('[email protected]')
->queue(new TeaAndCoffeePriceMail(
phone: $this->_request->input('phone'),
email: $this->_request->input('email')
)
);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello!
I have a problem with the mail service. If I send a letter without a queue, everything goes well. I can't figure out what's wrong.
Error: Symfony\Component\Mime\Exception\LogicException: An email must have a "To", "Cc", or "Bcc" header
Mailable file
class TeaAndCoffeePriceMail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
public function __construct(
public ?string $phone = null,
public ?string $email = null,
) {}
public function envelope(): Envelope
{
$envelope = new Envelope(
to: '[email protected]',
subject: 'Some subject',
tags: ['TeaAndCoffee', 'Price']
);
if ($this->email != null) $envelope->replyTo($this->email);
return $envelope;
}
public function content(): Content
{
return new Content(
markdown: 'mail.teaandcoffee',
with: [
'title' => 'Some title'
]
);
}
}
Controller File
class TeaAndCoffee extends Controller
{
protected Request $_request;
public function __construct(Request $request)
{
$this->_request = $request;
}
public function sendPrice()
{
$this->_request->validate([
'phone' => 'required_without:email|nullable|string',
'email' => 'required_without:phone|nullable|email',
]);
Mail::send(new TeaAndCoffeePriceMail(
phone: $this->_request->input('phone'),
email: $this->_request->input('email')
));
return response()->json(true);
}
}
I've tested similar configuration as yours on Laravel 12.12.0, works fine in all cases (To address is set in Envelope class or when sending; mail is queued or not).
Maybe update to latest Laravel 11 or even 12?
Please or to participate in this conversation.