jQuery in Action, 3rd edition
The moose likes Other JSE/JEE APIs and the fly likes Limit on the number of email addresses in the 'To' field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Limit on the number of email addresses in the Watch "Limit on the number of email addresses in the New topic

Limit on the number of email addresses in the 'To' field

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
we have a distribution list of 2000 users in the list.

we have used message.addRecipients() to send out an email using java mail. we have done this because the business wants only one email to be going out to 2000 users. and not one email/person.

however, we get outofmemoryerror, when we run the prg. the jvm heap size is 2GB size. when we tried to increase the heap size beyond this, the jvm could not be initialized.

please let me know what is the max limit of email addresses, that can be put in the 'To' field at a time? is there a limit?

SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20276

Yes, it's about 5.

Ok, now seriously. NEVER EVER EVER!! send out a mass email with that many people in the To address. If ever you need need to send out emails to many people, put them all in the BCC field, and yourself or a no-reply address or something like that in the To field.
If you don't, someone is 100% certain to forward the email, it gets forwarded a few times more and in the end some spammer gets it and has an extra 2000 email addresses to spam to.

Now ontopic. Whenever you put all 2000 addresses in the BCC field instead of the To field, you're very likely going to get the same problem. Now why 2GB shouldn't be enough for 2000 addresses (that's just over 2MB per address!) is something I can't answer you. Do you get the same problem if you use only 500 users? Are you adding huge attachments?

How To Ask Questions How To Answer Questions
I agree. Here's the link: http://aspose.com/file-tools
subject: Limit on the number of email addresses in the 'To' field
It's not a secret anymore!