This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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
Author

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
Sheriff

Joined: Oct 27, 2005
Posts: 19674
    
  18

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?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
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