[appengine-java] Re: Using JavaMail to send email to multiple recipients

2010-08-12 Thread Rodrigo
Well... But I guess my question is:

How do I override AppEngine's implementation of JavaMail so I can use
Sun's??

--

BTW, this is the code I'm using:


/**
 * Generic method to send an email
 */
public static void sendEmail(String fromEmail, String fromName,
List to, List cc, List bcc,
String subject, String body) throws
AddressException, MessagingException, 
UnsupportedEncodingException
{

Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(fromEmail, fromName));
for (String email : to) {
msg.addRecipient(Message.RecipientType.TO,
new InternetAddress(email));
}
for (String email : cc) {
msg.addRecipient(Message.RecipientType.CC,
new InternetAddress(email));
}
for (String email : bcc) {
msg.addRecipient(Message.RecipientType.BCC,
new InternetAddress(email));
}
msg.setSubject(subject);
msg.setText(body);
Transport.send(msg);
}


On Aug 11, 2:02 pm, Nasif Noorudeen  wrote:
> Hi,
>   can u specify the code's that you are currntly using, there is something
> is missing in your code, the implementaion of sun sample code is fine
>
> Thanks
> Nasif
>
> On Mon, Aug 9, 2010 at 3:41 PM, Rodrigo  wrote:
> > Hi,
>
> > I'm trying to send a single email to multiple recipients, but when I
> > add multiple recipients to a Message, it sends a different copy of the
> > email to each recipient! I want a single email.
>
> > Is there a way to get around this? I read in a previous post that
> > Sun's implementation of JavaMail didn't have this problem and that we
> > could override it somehow. How?
>
> > I tried downloading a jar from here [1], put it in my classpath and
> > the war/WEB-INF/lib, but it didn't make any difference. I also got the
> > source code from Sun, but there's a bunch of classes that are
> > unsupported by App Engine so I couldn't get it to work either.
>
> > Appreciate any help! Thanks,
> > -Rodrigo
>
> > [1]http://download.java.net/maven/2/javax/mail/mail/
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> > google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Using JavaMail to send email to multiple recipients

2010-08-13 Thread Rodrigo
And for completeness, the email-related classes used are:

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

All of which exist in Sun's mail.jar I'm using, which is also in the
classpath BEFORE the AppEngine library (just in case).

The bug remains unfixed.

On Aug 12, 8:10 pm, Rodrigo  wrote:
> Well... But I guess my question is:
>
> How do I override AppEngine's implementation of JavaMail so I can use
> Sun's??
>
> --
>
> BTW, this is the code I'm using:
>
>         /**
>          * Generic method to send an email
>          */
>         public static void sendEmail(String fromEmail, String fromName,
>                         List to, List cc, List bcc,
>                         String subject, String body) throws
>                         AddressException, MessagingException, 
> UnsupportedEncodingException
> {
>
>                 Properties props = new Properties();
>                 Session session = Session.getDefaultInstance(props, null);
>                 Message msg = new MimeMessage(session);
>                 msg.setFrom(new InternetAddress(fromEmail, fromName));
>                 for (String email : to) {
>                         msg.addRecipient(Message.RecipientType.TO,
>                                         new InternetAddress(email));
>                 }
>                 for (String email : cc) {
>                         msg.addRecipient(Message.RecipientType.CC,
>                                         new InternetAddress(email));
>                 }
>                 for (String email : bcc) {
>                         msg.addRecipient(Message.RecipientType.BCC,
>                                         new InternetAddress(email));
>                 }
>                 msg.setSubject(subject);
>                 msg.setText(body);
>                 Transport.send(msg);
>         }
>
> On Aug 11, 2:02 pm, Nasif Noorudeen  wrote:
>
> > Hi,
> >   can u specify the code's that you are currntly using, there is something
> > is missing in your code, the implementaion of sun sample code is fine
>
> > Thanks
> > Nasif
>
> > On Mon, Aug 9, 2010 at 3:41 PM, Rodrigo  wrote:
> > > Hi,
>
> > > I'm trying to send a single email to multiple recipients, but when I
> > > add multiple recipients to a Message, it sends a different copy of the
> > > email to each recipient! I want a single email.
>
> > > Is there a way to get around this? I read in a previous post that
> > > Sun's implementation of JavaMail didn't have this problem and that we
> > > could override it somehow. How?
>
> > > I tried downloading a jar from here [1], put it in my classpath and
> > > the war/WEB-INF/lib, but it didn't make any difference. I also got the
> > > source code from Sun, but there's a bunch of classes that are
> > > unsupported by App Engine so I couldn't get it to work either.
>
> > > Appreciate any help! Thanks,
> > > -Rodrigo
>
> > > [1]http://download.java.net/maven/2/javax/mail/mail/
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Google App Engine for Java" group.
> > > To post to this group, send email to
> > > google-appengine-j...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-appengine-java+unsubscr...@googlegroups.com
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine-java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.