Announcement Announcement Module
No announcement yet.
How many TO: email addresses can MimeMessageHelper handle? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How many TO: email addresses can MimeMessageHelper handle?


    Would the class:
    org.springframework.mail.javamail.MimeMessageHelpe r

    setTo(String[]) method able to handle about 25,000 email addresses?

  • #2
    even if Mime message can contain this many email address in its TO field, I do not think it is a great idea at all (well I would say it is a silly idea if you ask me to be frank).

    You will get 25000 email consumers each of whom will get a 25000 eamil addresses in their email header.

    This question by the wya has nothing to do with Spring, but a lot to do with common sense.



    • #3
      Well Alex, clam down.
      How do you suggest to mail your user community if their email addresses are in your DB and not on a group in your SMTP server?

      BTW - I don't think email clients will show all anyway since I hope it would truncate.

      Would you suggest looping and mailing each one individually? What is your common sense on an approach to this? Don't flame, make suggestions? We all try to learn from each other here and how they have implemented similar solutions in the past. :wink:


      • #4
        I am not flaming, I am just saying that sending all of theese emails in one email is no different than sending to each one indvidually. The difference only in who does the job. The drawback of sending 25K with 25K email addresses in it is obvious, comapring to 25K each one is with 1 address in the TO field.

        Think about it, if you put 25K email addresses in TO field what do you think your smtp gateway does with it, to send it out? It goes thru your TO field parses it, retrieves MX records for the domain of each one those emails and tries to communicate to each one of the hosts listed in MX record.

        Now if you think that just because you put all 25K addresses you will be sending one email is where common sense statement relevant.

        I am sorry if I ofended you in any way, it was not intended.



        • #5
          I am in complete agreement with you. My issue is that this application is used worldwide and there is really no real downtime or off hours to have the application send 25K mime emails including multiple emails. I think this will cause a big performace hit to the application. So I do see the downside of sending the 25K in the To: field. But the SMTP server can handle the load since that is what it does. But I also know what the users will see in their To field. So what I really what to do is have the SMTP server handle the 25K email addresses but somehow have the email sent out with a single group name rather than the 25K email addresses in the To: field. can this be done? and can it be done using the MimeMessageHelper?

          I guess I am unable to locate a best practice design on this.


          • #6
            I guess this is how to do it:

            To send an email to undisclosed recipients:
                * Create a new message in your email client.
                * Insert "Undisclosed Recipients" in the To&#58; field, followed by your email address in "<,>" braces.
                      o The To&#58; field should look like&#58; "Undisclosed Recipients <[email protected]>". 
                * Put all the recipients' email addresses in the Bcc&#58; field, separated by commas.
                      o The Bcc&#58; field could look like&#58; "[email protected], [email protected], [email protected]". 
                * Compose your message.
                * Send it.
            So now my question is can the setBcc(String[]) field handle the 25K email addresses?


            • #7
              the MimeMessageHelper is just a convenient wrapper around the javamail implementation and it simply iterates over the given array and call 25k times the setBcc method on the javax.mail.Message class.
              So, from the spring point of view, it is supported. It then depends on the chosen javamail implementation...



              • #8
                Yes, I acknowledge that. And that is kinda where I am going with the question, but wanted to ensure that the Mimemessagehelper was not adding any great deal of overhead with any custom processing and restrictions (i guess I should look at source code). I am still trying to investigate what the Javamail API says for limits but nothing concrete. What I found is that admins can impose max charater limits on the to, cc and bcc fields and other fields as well on the SMTP server. Thank you.