5 Replies Latest reply: Aug 20, 2010 2:08 PM by DrClap RSS

    sending mail to multiple recipients.

    843834
      Sir,
      I want to send mail to multiple recipient's.

      And condition is:

      list of recipients will generate at runtime,
      eg. no of employees whos salary is 5000

      now i want to send mail to all thos employees



      plz help me in these that how i can do this in servlet, and its a bit urgent



      thank you.

      Edited by: subodh_ahire on Aug 20, 2010 1:12 AM
        • 1. Re: sending mail to multiple recipients.
          bshannon
          Um, write a loop that calls addRecipient?

          Sorry, I'm not sure which part of this simple problem is confusing you.
          • 2. Re: sending mail to multiple recipients.
            843834
            Sir,
            i am confused at places::


            1> how to store output of resultset into stringbuffer
            2> how to use token synchronizer

            because i dont want to send multiple mail, i want to attach multiple recipients,

            please help me in this issues
            • 3. Re: sending mail to multiple recipients.
              bshannon
              If you're having trouble figuring out how to use JDBC, this is the wrong forum.

              Assuming you can get a ResultSet of email addresses and iterate over its members,
              simply call

              message.AddRecipient(Message.RecipientType.TO, new InternetAddress(address));

              for each address.

              You don't need a StringBuffer.

              I don't know what a token synchronizer is.
              • 4. Re: sending mail to multiple recipients.
                843834
                Sir,

                If i follow your statement then code will send multiple mail,but i want to send one mail for no. of users.


                like i want to send mail of hello user to 5 different people.
                • 5. Re: sending mail to multiple recipients.
                  DrClap
                  subodh_ahire wrote:
                  Sir,

                  If i follow your statement then code will send multiple mail,but i want to send one mail for no. of users.
                  No, it won't. The code created one message and added several recipients to it. As should be obvious by looking at it. Frankly I think you're in over your head with this question; it's obvious you don't know nearly enough about Java programming to be working on these topics. And asking vague questions on forums isn't going to fix that. You need to get a basic grounding in Java programming first.