Hey everyone, I’m trying to send emails to multiple recipients using CodeIgniter and Mailgun with SMTP. I’ve set up the config and I’m using recipient variables, but I’m running into a problem. All the recipients can see each other’s email addresses, which isn’t what I want.
I’ve checked the Mailgun docs, but I can’t figure out what I’m doing wrong. Any ideas on how to fix this so each recipient only sees their own email? Thanks in advance for any help!
I’ve encountered a similar issue when working with bulk emails in CodeIgniter. The problem lies in how you’re setting the ‘to’ field. Instead of using implode() to combine all recipients, you should use the bcc() method. This way, each recipient won’t see others’ addresses.
This approach should solve your privacy concern. Also, ensure you’re using the latest version of CodeIgniter’s email library, as older versions might have limitations with large recipient lists.
Remember to check Mailgun’s sending limits and consider breaking large lists into smaller batches if necessary.
I’ve been in your shoes, and I can tell you that using Mailgun with CodeIgniter for bulk emails can be tricky. One thing that worked for me was to send individual emails in a loop instead of using a single bulk send. It’s a bit slower, but it gives you more control. Here’s a rough idea:
This approach ensures each recipient only sees their own email. It also allows you to personalize each message easily. Just remember to handle any errors that might occur during the sending process, and consider using a queue system for large batches to avoid timeouts.