Ghost: Mailgun BATCH_SIZE with a fix value of 1000 is incompatible with new users

Issue Summary

Hi,

When you want to use Mailgun with the flex offer, they block your account to a maximum BATCH_SIZE to 10. This value is currently to defined to 1000 and cannot be overide with settings by the end user.

in bulk-email-processor.js : module.exports = { BATCH_SIZE: MailgunClient.BATCH_SIZE,

Could be : module.exports = { BATCH_SIZE: bulkEmailConfig?.mailgun?.batch_size,

A new setting to allow the users to set a BATCH_SIZE to 10 could be great to allow Mailgun to evaluate the mail quality before to increase to 1000 the batch size.

Thank-you !

Steps to Reproduce

  1. Create a ghost instance.
  2. Create a Mailgun account.
  3. Add 11 members to the newsletter
  4. Send a newsletter
  5. Mailgun will not accept more that 10 members in the recipient.

Ghost Version

v5.19.0

Node.js Version

v16.17.0

How did you install Ghost?

Ghost CLI + Ghost Update

Database type

MySQL 8

Browser & OS version

No response

Relevant log / error output

No response

Code of Conduct

  • I agree to be friendly and polite to people in this repository

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

We are actively talking to mailgun about how to make the onboarding process work more smoothly. I’ve raised this to them as, as far as I know, there is no way for us to auto-detect when the account is limited.

Hi there, has anyone found a resolution for this?

I have the exact same 420 error code that @alias-rahil got and when reaching out to mailgun they said I need 3-5 days of consistent sending with the following limits: “a maximum of 100 messages per hour, a maximum of 9 recipients per message”

I’ve changed the batch size to 1 as suggested by @dest4 but am limited by the 100 messages per hour because it somehow puts a 12-hour restriction on the account.

Waiting on a response from Mailgun about taking my handcuffs off but it seems impractical to start sending newsletters when the sole newsletter provider for Ghost is not conducive to this, especially when you’ve got existing subscribers to start with.

It would be great if we could make this configurable - I’m currently having the problem as well with only 37 subscribers…and I’m running Ghost in Docker so I can’t easily modify the code.

Knowing before trying that the account is limited is probably not possible. But once the call to Mailgun API fails, it seems to be possible to infer it.

Here are a couple of lines of log when sending fails due to account limitation

[2022-10-31 19:38:29] WARN The email service received an error from mailgun and was unable to send.

The email service received an error from mailgun and was unable to send.

"Mailgun Error 403: Domain mg.XXXXX.fr is not allowed to send large batches yet"
"https://ghost.org/docs/newsletters/#bulk-email-configuration"

Error ID:
    9856dae0-5953-11ed-a2d9-XXXXXXXXX

Error Code: 
    BULK_EMAIL_SEND_FAILED

----------------------------------------

EmailError: The email service received an error from mailgun and was unable to send.
    at Object.send (/var/lib/ghost/versions/5.20.0/core/server/services/bulk-email/bulk-email-processor.js:260:30)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.processEmailBatch (/var/lib/ghost/versions/5.20.0/core/server/services/bulk-email/bulk-email-processor.js:179:34)
    at async Promise.map.concurrency (/var/lib/ghost/versions/5.20.0/core/server/services/bulk-email/bulk-email-processor.js:104:17)

The is not allowed to send large batches yet seems specific-enough. Though I don’t know how stable over time this heuristic can be.