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

BatchMessage modifies stored test deliveries #344

Open
nivla opened this issue Feb 10, 2025 · 0 comments
Open

BatchMessage modifies stored test deliveries #344

nivla opened this issue Feb 10, 2025 · 0 comments
Assignees

Comments

@nivla
Copy link

nivla commented Feb 10, 2025

Description

When using Mailgun::Client in test mode with batch messages, the reset_message method in BatchMessage modifies the original hash stored in Mailgun::Client.deliveries. This causes the stored test deliveries to lose their :to, :cc, :bcc and recipient-variables data after the batch is processed.

Steps to Reproduce

  1. Enable test mode on Mailgun client
  2. Create a batch message with recipients (to, cc, bcc)
  3. Send the message
  4. Check the stored delivery in Mailgun::Client.deliveries
  5. The stored hash is modified after reset_message is called

Code Example

client = Mailgun::Client.new('key')
client.enable_test_mode!
batch = Mailgun::BatchMessage.new(client, 'domain.com')
batch.add_recipient(:to, '[email protected]')
batch.add_recipient(:cc, '[email protected]')
batch.add_recipient(:bcc, '[email protected]')
batch.finalize

# At this point, checking `Mailgun::Client.deliveries` the to/cc/bcc/recipient-variables fields are gone
@alex-leb alex-leb self-assigned this Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants