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

Documentation for batch email sending ? #41

Open
sahanDissanayake opened this issue Jul 4, 2016 · 9 comments
Open

Documentation for batch email sending ? #41

sahanDissanayake opened this issue Jul 4, 2016 · 9 comments
Labels

Comments

@sahanDissanayake
Copy link

No description provided.

@sahanDissanayake
Copy link
Author

@dwyl any thoughts ?

@nelsonic
Copy link
Member

nelsonic commented Jul 8, 2016

@sahanDissanayake how many emails do you want to send per batch?
What type of email? e.g: newsletter? will the email not include any personalisation? (i.e. all the same?)

@sahanDissanayake
Copy link
Author

Hi Nelson,

This is my scenario.

My situation is farily simple..
Lets me explain.
I have clients.. lets say 100
My clients have customers lets say 1000 each
So one of my clients wants to send out a newsletter to their 1000 customers using my app.

So each email will have the user first name. That is the only personalisation for the email that needs doing.

@nelsonic
Copy link
Member

nelsonic commented Jul 8, 2016

Ok, so you're sending an individual email to each recipient.
Surely, you can create a loop to send the emails?

// GET list of recipients from database, iterate over list and send to each
database.get('recipients', (err, list) => {
  // handle error
  list.forEach(recipient => {
    // see: https://github.com/dwyl/sendemail#4-send-an-email
    sendEmail('newsletter', recipient, (err, result) => {
      // update the "sent/history" table for each recipient
    });
  }
}

Provided you have authenticated your AWS account you should be able to send as many emails as you like using this process.

If you need a more detailed example, let us know.

@sahanDissanayake
Copy link
Author

sahanDissanayake commented Jul 8, 2016

Awesome. but sending a 1000 emails a second in a loop fashion is not a bad practice right ?
I would like to hear some opinion on this too please ?

If all well.. I'm happy to close this issue

@nelsonic
Copy link
Member

nelsonic commented Jul 8, 2016

@sahanDissanayake very good question!
if you are sending thousands of emails per second, you may need consider limiting, to avoid exhausting your stack. there are two ways you can do this:
a. write your own asynchronous limit code by following an example: http://stackoverflow.com/questions/9539886/limiting-asynchronous-calls-in-node-js
b. use Async http://caolan.github.io/async/docs.html#.parallelLimit

If you need a code example, please let us know. 👍

@sahanDissanayake
Copy link
Author

sahanDissanayake commented Jul 8, 2016

Awesome.. I will give you an update soon 👍 with in the next 48 hours

If you need a code example, please let us know.

@nelsonic I mean I would love to see some pro code if its not too much trouble 😇

@sahanDissanayake
Copy link
Author

sahanDissanayake commented Jul 9, 2016

@nelsonic should I expect a code sample from you with the async module ?

Also could you tell me how many concurrent emails you send currently in your company please using this package ?

@nelsonic
Copy link
Member

nelsonic commented Aug 9, 2016

@sahanDissanayake really sorry to no reply sooner, do you still need help?

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

No branches or pull requests

2 participants