Support the ongoing development of →
posted 9 years ago
Last updated 2 years ago.

That exception explained: Swiftmailer GitHub Issue

The way you have phrased your question setup is a little awkward.

When it errors, is your code like this:

$toEmails = " '[email protected]', '[email protected]', '[email protected]', '[email protected]' ";
$message->to('[email protected]')->cc($toEmails);

or like this:

$toEmails = array('[email protected]', '[email protected]', '[email protected]', '[email protected]');
$message->to('[email protected]')->cc($toEmails);

or something else?

The RFC (specifically section 3.4) describes the address list construction:

valid address lists look like:

[email protected]
<[email protected]>
"User Name" <[email protected]>
[email protected], [email protected], [email protected]
<[email protected]>, <[email protected]>, <[email protected]>
"User Name 1" <[email protected]>, "User Name 2" <[email protected]>, "User Name 3" <[email protected]>

I suspect that your single quotes simply don't follow the spec. try removing the single quotes from around the email addresses.

Last updated 2 years ago.

I've tested it using the following code:

$emails = ['[email protected]', '[email protected]','[email protected]'];

Mail::send('emails.welcome', [], function($message) use ($emails) {
$message->to($emails)->subject('This is test e-mail');
}); var_dump( Mail:: failures()); exit; Result - empty array for failures.

But of course you need to configure your app/config/mail.php properly. So first make sure you can send e-mail just to one user and then test your code with many users.

Moreover using this simple code none of my e-mails were delivered to free mail accounts, I got only emails to inboxes that I have on my paid hosting accounts, so probably they were caught by some filters (it's maybe simple topic/content issue but I mentioned it just in case you haven't received some of e-mails) .


Hello, I am having a trouble when sending my form that allows to offer the user a page that allows them to enter their email, that of an acquaintance and an accompanying message.

I have this error appears: Address in mailbox given [email] does not comply with RFC 2822, 3.6.2. related to control by the function assertValidAddress($address) present in the file MailBoxHeader.

Here is my code in the controller : [code]public function postShare() {

$rules = [

'email' => 'required|email', 'emailcollaborator' => 'required|email', 'message' => 'required|min:5',


$fields = Input::all(); $validator = Validator::make($fields, $rules);

$email = 'email'; // The form validation was good if ($validator->passes()) {

// We finally send an email to confirm the account     $data = array(

    'email' => $fields['email'],     'emailcollaborator' => $fields['emailcollaborator'],     'message' => $fields['message']


Mail::queue('emails.share', $data, function($message) use ($email) { $message->from($email, 'Moi'); $message->to('emailcollaborator')->subject('Welcome!'); });

//addLogAuth::user()->id, 'Demande de contact effectué');

Session::flash('message', "Votre message a bien été envoyé à votre destinataire");

return Redirect::to('/home/share');

} else {

// We return the same page with the error and saving the input datas return Redirect::back() ->withInput() ->withErrors($validator);


} [/code]

Can anyone give me a track to solve the difficulty I encounter?


plz make sure there is no white space before or after the email address given


I think you should try this

$emails[$i] = str_replace(' ', '', $emails[$i]);

Removing white-space on every emails you split is very important.. this will avoid such errors.


Sign in to participate in this thread!


Your banner here too?

jasondavis jasondavis Joined 19 Feb 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.