Comments (3)
Thanks @Bogardo I didn't see $message->recipientVariables in the documentation so I was also wondering. I see it in the code now.
Might consider returning $this so we can chain functions.
from mailgun.
The best way to fix this is by using recipient variables.
From the Mailgun Documentation:
Batch Sending
Mailgun supports the ability send to a group of recipients through a single API call.
This is achieved by either:
- Using Batch Sending by specifying multiple recipient email addresses as to parameters and using Recipient Variables.
- Using Mailing Lists with Template Variables.
Warning It is important when using Batch Sending to also use Recipient Variables. This tells Mailgun to send each recipient an individual email with only their email in the to field. If they are not used, all recipients’ email addresses will show up in the to field for each recipient.
Take special note of the last (bold) paragraph.
Example:
Mailgun::send(emails.mudrush', $data, function($message)
{
$message->to([
'[email protected]',
'[email protected]',
'[email protected]',
]);
$message->recipientVariables([
'[email protected]' => ['name' => 'John Doe'],
'[email protected]' => ['name' => 'Foo Bar'],
'[email protected]' => ['name' => 'Baz Bar'],
]);
});
Another option would probably be to use the bcc() method but I recommend using the recipient variables.
Mailgun::send('emails.mudrush', $data, function($message) use($users)
{
$message->subject('Last day to WIN free passes to The Mud Rush');
$message->bcc($users);
});
Simmilar issues:
Issue using To foreach loop #31
Support for recipient variables #34
from mailgun.
I am trying to accomplish same as @dustingraham . I want to use recipientVariables
My question is:
If all email addresses are in and array, How do I pass them into here?
'[email protected]',
'[email protected]',
'[email protected]',
]);
$message->recipientVariables([
'[email protected]' => ['name' => 'John Doe'],
'[email protected]' => ['name' => 'Foo Bar'],
'[email protected]' => ['name' => 'Baz Bar'],
]);
Say I have something like this:
$e = array_chunk($emails, 900);
Mailgun::send(emails.mudrush', $data, function($message)
{
$message->to([
(How would I pass the email addresses in here?)
'[email protected]',
'[email protected]',
'[email protected]',
]);
$message->recipientVariables([
(How would I pass the recipient variables in here?)
'[email protected]' => ['name' => 'John Doe'],
'[email protected]' => ['name' => 'Foo Bar'],
'[email protected]' => ['name' => 'Baz Bar'],
]);
});```
I have been trying to figure this out for a long time.
Thank you very much.
from mailgun.
Related Issues (20)
- Clarification please regarding handling of http_response_body content and possibly guzzle and/or env setting? HOT 3
- Undefined Method error
- Type error: Argument 1 passed must be an instance of App\Http\Controllers\Message HOT 1
- Example send email to mailing list HOT 1
- Troubles with the API request, deprecated usable of mailgun-php lib HOT 2
- .
- Trying to get property of non-object HOT 1
- Update nesbot/carbon dependency HOT 1
- Cannot install php-http/guzzle6-adapter HOT 2
- Switching endpoint HOT 2
- Using full api from mailgun-php HOT 2
- Install on Laravel 5.8? HOT 4
- ERROR when passing a variable to to() HOT 1
- new release 5.1.0 with Carbon 2 is not available via composer and isn't on packagist HOT 1
- Error installing this package on Laravel 5.8 (clunky workaround included...can we fix the package?) HOT 1
- Upgrade Laravel 6 HOT 1
- Unable to install php-http / guzzle6-adapter in symfony 4.1
- Emails are not being sent or received.
- Mailgun custom notification channel
- specific attachment to each recipient in batch emails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mailgun.