Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BCC #1

Closed
JordyMiljaar opened this issue Dec 16, 2016 · 3 comments
Closed

BCC #1

JordyMiljaar opened this issue Dec 16, 2016 · 3 comments

Comments

@JordyMiljaar
Copy link

Hey

First off all, great plugin!

Is it possible that bcc doesn't work? Also, how do you add multiple contacts?

Best regards
Jordy

@narendravaghela
Copy link
Owner

Hi @JordyMiljaar,
Thank you!

The bcc function works. You can add bcc contact by using addBcc() method like,

$email = new Email('mailgun');
$email->template('default', '')
    ->from(['example@example.com' => 'Example'])
    ->addTo('foo@example.com', 'Foo')
    ->addBcc('bar@example.com', 'Bar')
    ->emailFormat('html')
    ->subject("Mailgun Test")
    ->viewVars(['content' => 'demo content'])
    ->send();

And I think Mailgun takes little bit more time to send Bcc emails.

Regarding multiple contacts, as per Mailgun, you can use recipient-variables option and multiple addTo() method like below,

$recipients = [
    'foo@example.com' => [
        'name' => 'Foo'
    ],
    'bar@example.com' => [
        'name' => 'Bar'
    ]
];

$email = new Email('mailgun');
$email->template('default', '')
    ->from(['example@example.com' => 'ExampleServer'])
    ->emailFormat('html')
    ->subject("Mailgun Test - " . date('Y-m-d H:i:s'))
    ->viewVars(['content' => 'demo content']);

foreach ($recipients as $mail => $contact) {
    $email->addTo($mail, $contact['name']);
}

$email->addHeaders(['ev:recipient-variables' => json_encode($recipients)]);
$email->send();

@JordyMiljaar
Copy link
Author

Thanks a lot 😉

I used just bcc()!

@narendravaghela
Copy link
Owner

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants