Laravel Mail::send() Send Multiple mails with to and cc addresses

Viewed 2089

I'm new to Laravel here. My aim is to send multiple mails using Mail::send() with to or cc

I have been retrieving my stored emails from .env file:

toEmails='one@domain.ext','two@domain.ext'

Retrieving the emails from a controller and sending using the below code:

$toEmails = env('toEmails');

$message->to(toEmails); OR $message->cc(toEmails);

The following code is continuously resulting with a error:

Swift_RfcComplianceException in MailboxHeader.php line 345: Address in mailbox given [[email protected],[email protected]] does not comply with RFC 2822, 3.6.2.

I have been trying the below codes which did'nt work for me. In .env file

toEmails=array('one@domain.ext','two@domain.ext'),
toEmails=one@domain.ext,two@domain.ext'

How can i recover from it.

1 Answers
Related