[appengine-java] Re: Not sending email with Javamail and no error

2010-12-23 Thread captain

Hi all,

My code was working two weeks ago and now I found myself in the same
situation of the original post

Hard to tell what is going on with the java mail service. Definitely
something changed.

Claudio






Of
On Dec 18, 7:29 am, "@bh!jiT"  wrote:
> Ok few things when dealing with mail API
>
> First and most important thing is* from address* could only be any of the
> below for security reasons, that means you can't send mails from any id you
> like
>
> The sender address must be one of the following types:
>
>    - The address of a registered administrator for the application
>    - The address of the user for the current request signed in with a Google
>    Account. You can determine the current user's email address with the
>    Users API .
>    - Any valid email receiving address for the app (such as
>    x...@app-id.appspotmail.com).
>
> I use the last one, use anything you like ad...@app-id.appspotmail.com if
> you want the receiver of this mail to reply to email id of your choice use
> replyTo to set that.
>
> Now mails can only be sent from applications deployed on app server.
> Local/dev server doesn't send any mails at all but yes it does display the
> logs in console.
>
> *Last bit of detail is by default logging.properties in WEB-INF folder is
> set to WARN change it to info i.e.
> .level = INFO
> This will show you the messages on console.*
>
> Hope the above helps, I struggled a lot too :)

-- 
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.



Re: [appengine-java] Re: Not sending email with Javamail and no error

2010-12-18 Thread @bh!jiT
Ok few things when dealing with mail API

First and most important thing is* from address* could only be any of the 
below for security reasons, that means you can't send mails from any id you 
like

The sender address must be one of the following types:

   - The address of a registered administrator for the application
   - The address of the user for the current request signed in with a Google 
   Account. You can determine the current user's email address with the 
   Users API .
   - Any valid email receiving address for the app (such as 
   x...@app-id.appspotmail.com).

I use the last one, use anything you like ad...@app-id.appspotmail.com if 
you want the receiver of this mail to reply to email id of your choice use 
replyTo to set that.

Now mails can only be sent from applications deployed on app server. 
Local/dev server doesn't send any mails at all but yes it does display the 
logs in console. 

*Last bit of detail is by default logging.properties in WEB-INF folder is 
set to WARN change it to info i.e.
.level = INFO
This will show you the messages on console.*

Hope the above helps, I struggled a lot too :)

-- 
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.



Re: [appengine-java] Re: Not sending email with Javamail and no error

2010-12-17 Thread A. Stevko
Straight zero utilizations means the email api is not accepting your
requests rather than the message getting lost in transit.
Where the error goes is not obvious due to Issue 1800
I suggest continuing to replace your fields with static values to see which
one is not accepted.
My gut says to check the character set - UTF-8 works fine for me.
Otherwise you may be encountering a known issue with the mail server:
http://code.google.com/p/googleappengine/issues/list?can=2&q=component%3DMail&colspec=ID+Type+Component+Status+Stars+Summary+Language+Priority+Owner+Log&cells=tiles

Here is my code, I've embedded it into a queue task and it works thousands
of times daily.

Message msg = new MimeMessage(session);

msg.setFrom(new InternetAddress(fromAddress, fromName));

msg.addRecipient(Message.RecipientType.TO,

new InternetAddress( toAddress, toName ));

msg.setReplyTo( ADMIN_ADDRESSES );

msg.addHeader( "Return-Path" , ADMIN_ADDRESS );

if ( bccSupport != null && !bccSupport.isEmpty() ) {

// only add support bcc if specified

msg.addRecipient( Message.RecipientType.BCC, new InternetAddress( bccSupport
> ));

}

msg.setSubject(subject);

msg.setText( body );

Transport.send(msg);




On Thu, Dec 16, 2010 at 10:01 PM, Moretto  wrote:

> As you see the first time i've deployed my app, 2 email were sent. It
> appeared at my cota details. Now  Could you post your headers details?
>
> Mail API Calls   0%  0 of 7,000  Okay
> Recipients Emailed   0%  0 of 2,000  Okay
> Admins Emailed   0%  0 of 5,000  Okay
> Message Body Data Sent   0%  0.00 of 0.06 GBytes Okay
> Attachments Sent 0%  0 of 2,000  Okay
> Attachment Data Sent 0%  0.00 of 0.10 GBytes Okay
>
> On Dec 17, 2:21 am, "A. Stevko"  wrote:
> > I have much the same code although I set more headers.
> > How about adding yourself as a BCC and/or CC?
> > Also, do you see any utilization  in your Quota details - Mail API Calls
> > and Recipients Emailed ?
> >
> >
> >
> > On Thu, Dec 16, 2010 at 8:12 PM, Moretto  wrote:
> > > Still no messagesand no errors
> >
> > >  Properties props = new Properties();
> > >Session session = Session.getDefaultInstance(props, null);
> >
> > >  //  UserService userService =
> > > UserServiceFactory.getUserService();
> > >//User user = userService.getCurrentUser();
> > >try {
> > >Message msg = new MimeMessage(session);
> > >//msg.setFrom(new InternetAddress(user.getEmail()));
> > > msg.setFrom(new InternetAddress("mala...@gmail.com", "[k-
> > > share]"));
> > > msg.addRecipient(Message.RecipientType.TO,
> > >new InternetAddress(email, destinatario));
> > >msg.setSubject(titulo);
> > >msg.setText(texto);
> > >Transport.send(msg);
> >
> > >} catch (AddressException e) {
> > >e.printStackTrace();
> > >return false;
> > >} catch (MessagingException e) {
> > >e.printStackTrace();
> > >return false;
> > >} catch (Exception e) {
> > >e.printStackTrace();
> > >return false;
> > >}
> > >return true;
> >
> > > On Dec 17, 2:03 am, Moretto  wrote:
> > > > "can send email messages on behalf of the app's administrators, and
> on
> > > > behalf of users with Google Accounts."
> >
> > > > UserService userService = UserServiceFactory.getUserService();
> > > > User user = userService.getCurrentUser();
> >
> > > > These two lines of code retrieve the current google user logged in.
> > > > i'll change it and test.
> >
> > > > On Dec 17, 1:52 am, "A. Stevko"  wrote:
> >
> > > > > I now recall the conditions...
> > >http://code.google.com/appengine/docs/java/mail/overview.html
> >
> > > > > > App Engine applications can send email messages on behalf of the
> > > app's
> > > > > > administrators, and on behalf of users with Google Accounts.
> > > > > On Thu, Dec 16, 2010 at 7:49 PM, A. Stevko 
> > > wrote:
> > > > > > Does the email address used in your From have administrator
> > > privileges for
> > > > > > your app?
> >
> > > > > >msg.setFrom(new InternetAddress(user.getEmail()));
> >
> > > > > > I read somewhere that system could only send email from
> registered
> > > email
> > > > > > addresses.
> >
> > > > > > On Thu, Dec 16, 2010 at 7:13 PM, Moretto 
> wrote:
> >
> > > > > >> I've changed the code to initialize the Session object passing
> > > > > >> properties as a parameter. Nothing changed. Still does not send
> > > emails
> > > > > >> and doesnt throws any exception. Ideias??
> >
> > > > > >>  Properties props = new Properties();
> > > > > >>Session session = Session.getDefaultInstance(props,
> null);

[appengine-java] Re: Not sending email with Javamail and no error

2010-12-16 Thread Moretto
As you see the first time i've deployed my app, 2 email were sent. It
appeared at my cota details. Now  Could you post your headers details?

Mail API Calls   0%  0 of 7,000  Okay
Recipients Emailed   0%  0 of 2,000  Okay
Admins Emailed   0%  0 of 5,000  Okay
Message Body Data Sent   0%  0.00 of 0.06 GBytes Okay
Attachments Sent 0%  0 of 2,000  Okay
Attachment Data Sent 0%  0.00 of 0.10 GBytes Okay

On Dec 17, 2:21 am, "A. Stevko"  wrote:
> I have much the same code although I set more headers.
> How about adding yourself as a BCC and/or CC?
> Also, do you see any utilization  in your Quota details - Mail API Calls
> and Recipients Emailed ?
>
>
>
> On Thu, Dec 16, 2010 at 8:12 PM, Moretto  wrote:
> > Still no messagesand no errors
>
> >  Properties props = new Properties();
> >        Session session = Session.getDefaultInstance(props, null);
>
> >      //  UserService userService =
> > UserServiceFactory.getUserService();
> >    //    User user = userService.getCurrentUser();
> >        try {
> >            Message msg = new MimeMessage(session);
> >            //msg.setFrom(new InternetAddress(user.getEmail()));
> >             msg.setFrom(new InternetAddress("mala...@gmail.com", "[k-
> > share]"));
> >             msg.addRecipient(Message.RecipientType.TO,
> >                    new InternetAddress(email, destinatario));
> >            msg.setSubject(titulo);
> >            msg.setText(texto);
> >            Transport.send(msg);
>
> >        } catch (AddressException e) {
> >            e.printStackTrace();
> >            return false;
> >        } catch (MessagingException e) {
> >            e.printStackTrace();
> >            return false;
> >        } catch (Exception e) {
> >            e.printStackTrace();
> >            return false;
> >        }
> >        return true;
>
> > On Dec 17, 2:03 am, Moretto  wrote:
> > > "can send email messages on behalf of the app's administrators, and on
> > > behalf of users with Google Accounts."
>
> > > UserService userService = UserServiceFactory.getUserService();
> > >         User user = userService.getCurrentUser();
>
> > > These two lines of code retrieve the current google user logged in.
> > > i'll change it and test.
>
> > > On Dec 17, 1:52 am, "A. Stevko"  wrote:
>
> > > > I now recall the conditions...
> >http://code.google.com/appengine/docs/java/mail/overview.html
>
> > > > > App Engine applications can send email messages on behalf of the
> > app's
> > > > > administrators, and on behalf of users with Google Accounts.
> > > > On Thu, Dec 16, 2010 at 7:49 PM, A. Stevko 
> > wrote:
> > > > > Does the email address used in your From have administrator
> > privileges for
> > > > > your app?
>
> > > > >            msg.setFrom(new InternetAddress(user.getEmail()));
>
> > > > > I read somewhere that system could only send email from registered
> > email
> > > > > addresses.
>
> > > > > On Thu, Dec 16, 2010 at 7:13 PM, Moretto  wrote:
>
> > > > >> I've changed the code to initialize the Session object passing
> > > > >> properties as a parameter. Nothing changed. Still does not send
> > emails
> > > > >> and doesnt throws any exception. Ideias??
>
> > > > >>      Properties props = new Properties();
> > > > >>        Session session = Session.getDefaultInstance(props, null);
>
> > > > >>         UserService userService =
> > UserServiceFactory.getUserService();
> > > > >>        User user = userService.getCurrentUser();
> > > > >>        try {
> > > > >>            Message msg = new MimeMessage(session);
> > > > >>            msg.setFrom(new InternetAddress(user.getEmail()));
> > > > >>            msg.addRecipient(Message.RecipientType.TO,
> > > > >>                    new InternetAddress(email, destinatario));
> > > > >>            msg.setSubject(titulo);
> > > > >>            msg.setText(texto);
> > > > >>            Transport.send(msg);
>
> > > > >>        } catch (AddressException e) {
> > > > >>            e.printStackTrace();
> > > > >>            return false;
> > > > >>        } catch (MessagingException e) {
> > > > >>            e.printStackTrace();
> > > > >>            return false;
> > > > >>        } catch (Exception e) {
> > > > >>            e.printStackTrace();
> > > > >>            return false;
> > > > >>        }
> > > > >>        return true;
>
> > > > >> On Dec 14, 12:11 pm, Amit Pandey  wrote:
> > > > >> > Just try creating session object using property object. May be it
> > can
> > > > >> > help(Not sure).
>
> > > > >> > Properties props = new Properties();
> > > > >> >         Session session = Session.getDefaultInstance(props, null);
>
> > > > >> > On Tue, Dec 14, 2010 at 9:21 AM, Moretto 
> > wrote:
> > > > >> > > Hi,
>
> > > > >> > > I'm using JAVAMAIL to send mail from my GAE app located at
> > > > >> > >http://k-share.appspot.com/.
>
> > > > >> > > I can't send email and no error occurs. The first time i've
> > 

Re: [appengine-java] Re: Not sending email with Javamail and no error

2010-12-16 Thread A. Stevko
I have much the same code although I set more headers.
How about adding yourself as a BCC and/or CC?
Also, do you see any utilization  in your Quota details - Mail API Calls
and Recipients Emailed ?



On Thu, Dec 16, 2010 at 8:12 PM, Moretto  wrote:

> Still no messagesand no errors
>
>  Properties props = new Properties();
>Session session = Session.getDefaultInstance(props, null);
>
>
>  //  UserService userService =
> UserServiceFactory.getUserService();
>//User user = userService.getCurrentUser();
>try {
>Message msg = new MimeMessage(session);
>//msg.setFrom(new InternetAddress(user.getEmail()));
> msg.setFrom(new InternetAddress("mala...@gmail.com", "[k-
> share]"));
> msg.addRecipient(Message.RecipientType.TO,
>new InternetAddress(email, destinatario));
>msg.setSubject(titulo);
>msg.setText(texto);
>Transport.send(msg);
>
>} catch (AddressException e) {
>e.printStackTrace();
>return false;
>} catch (MessagingException e) {
>e.printStackTrace();
>return false;
>} catch (Exception e) {
>e.printStackTrace();
>return false;
>}
>return true;
>
> On Dec 17, 2:03 am, Moretto  wrote:
> > "can send email messages on behalf of the app's administrators, and on
> > behalf of users with Google Accounts."
> >
> > UserService userService = UserServiceFactory.getUserService();
> > User user = userService.getCurrentUser();
> >
> > These two lines of code retrieve the current google user logged in.
> > i'll change it and test.
> >
> > On Dec 17, 1:52 am, "A. Stevko"  wrote:
> >
> >
> >
> > > I now recall the conditions...
> http://code.google.com/appengine/docs/java/mail/overview.html
> >
> > > > App Engine applications can send email messages on behalf of the
> app's
> > > > administrators, and on behalf of users with Google Accounts.
> > > On Thu, Dec 16, 2010 at 7:49 PM, A. Stevko 
> wrote:
> > > > Does the email address used in your From have administrator
> privileges for
> > > > your app?
> >
> > > >msg.setFrom(new InternetAddress(user.getEmail()));
> >
> > > > I read somewhere that system could only send email from registered
> email
> > > > addresses.
> >
> > > > On Thu, Dec 16, 2010 at 7:13 PM, Moretto  wrote:
> >
> > > >> I've changed the code to initialize the Session object passing
> > > >> properties as a parameter. Nothing changed. Still does not send
> emails
> > > >> and doesnt throws any exception. Ideias??
> >
> > > >>  Properties props = new Properties();
> > > >>Session session = Session.getDefaultInstance(props, null);
> >
> > > >> UserService userService =
> UserServiceFactory.getUserService();
> > > >>User user = userService.getCurrentUser();
> > > >>try {
> > > >>Message msg = new MimeMessage(session);
> > > >>msg.setFrom(new InternetAddress(user.getEmail()));
> > > >>msg.addRecipient(Message.RecipientType.TO,
> > > >>new InternetAddress(email, destinatario));
> > > >>msg.setSubject(titulo);
> > > >>msg.setText(texto);
> > > >>Transport.send(msg);
> >
> > > >>} catch (AddressException e) {
> > > >>e.printStackTrace();
> > > >>return false;
> > > >>} catch (MessagingException e) {
> > > >>e.printStackTrace();
> > > >>return false;
> > > >>} catch (Exception e) {
> > > >>e.printStackTrace();
> > > >>return false;
> > > >>}
> > > >>return true;
> >
> > > >> On Dec 14, 12:11 pm, Amit Pandey  wrote:
> > > >> > Just try creating session object using property object. May be it
> can
> > > >> > help(Not sure).
> >
> > > >> > Properties props = new Properties();
> > > >> > Session session = Session.getDefaultInstance(props, null);
> >
> > > >> > On Tue, Dec 14, 2010 at 9:21 AM, Moretto 
> wrote:
> > > >> > > Hi,
> >
> > > >> > > I'm using JAVAMAIL to send mail from my GAE app located at
> > > >> > >http://k-share.appspot.com/.
> >
> > > >> > > I can't send email and no error occurs. The first time i've
> deployed
> > > >> > > my app, it send 2 email then no more.
> >
> > > >> > > Take a look at the source code below:
> >
> > > >> > > /*
> > > >> > >  * To change this template, choose Tools | Templates
> > > >> > >  * and open the template in the editor.
> > > >> > >  */
> > > >> > > package com.appspot.kshare.control;
> >
> > > >> > > import com.google.appengine.api.users.User;
> > > >> > > import com.google.appengine.api.users.UserService;
> > > >> > > import com.google.appengine.api.users.UserServiceFactory;
> > > >> > > import java.io.UnsupportedEncodingException;
> > > >> > > import javax.mail.Message;
> > > >> > > import javax.mail.MessagingException;
> > > >> > > import javax.mail.Session;

[appengine-java] Re: Not sending email with Javamail and no error

2010-12-16 Thread Moretto
Still no messagesand no errors

 Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);


  //  UserService userService =
UserServiceFactory.getUserService();
//User user = userService.getCurrentUser();
try {
Message msg = new MimeMessage(session);
//msg.setFrom(new InternetAddress(user.getEmail()));
msg.setFrom(new InternetAddress("mala...@gmail.com", "[k-
share]"));
msg.addRecipient(Message.RecipientType.TO,
new InternetAddress(email, destinatario));
msg.setSubject(titulo);
msg.setText(texto);
Transport.send(msg);

} catch (AddressException e) {
e.printStackTrace();
return false;
} catch (MessagingException e) {
e.printStackTrace();
return false;
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;

On Dec 17, 2:03 am, Moretto  wrote:
> "can send email messages on behalf of the app's administrators, and on
> behalf of users with Google Accounts."
>
> UserService userService = UserServiceFactory.getUserService();
>         User user = userService.getCurrentUser();
>
> These two lines of code retrieve the current google user logged in.
> i'll change it and test.
>
> On Dec 17, 1:52 am, "A. Stevko"  wrote:
>
>
>
> > I now recall the 
> > conditions...http://code.google.com/appengine/docs/java/mail/overview.html
>
> > > App Engine applications can send email messages on behalf of the app's
> > > administrators, and on behalf of users with Google Accounts.
> > On Thu, Dec 16, 2010 at 7:49 PM, A. Stevko  wrote:
> > > Does the email address used in your From have administrator privileges for
> > > your app?
>
> > >            msg.setFrom(new InternetAddress(user.getEmail()));
>
> > > I read somewhere that system could only send email from registered email
> > > addresses.
>
> > > On Thu, Dec 16, 2010 at 7:13 PM, Moretto  wrote:
>
> > >> I've changed the code to initialize the Session object passing
> > >> properties as a parameter. Nothing changed. Still does not send emails
> > >> and doesnt throws any exception. Ideias??
>
> > >>      Properties props = new Properties();
> > >>        Session session = Session.getDefaultInstance(props, null);
>
> > >>         UserService userService = UserServiceFactory.getUserService();
> > >>        User user = userService.getCurrentUser();
> > >>        try {
> > >>            Message msg = new MimeMessage(session);
> > >>            msg.setFrom(new InternetAddress(user.getEmail()));
> > >>            msg.addRecipient(Message.RecipientType.TO,
> > >>                    new InternetAddress(email, destinatario));
> > >>            msg.setSubject(titulo);
> > >>            msg.setText(texto);
> > >>            Transport.send(msg);
>
> > >>        } catch (AddressException e) {
> > >>            e.printStackTrace();
> > >>            return false;
> > >>        } catch (MessagingException e) {
> > >>            e.printStackTrace();
> > >>            return false;
> > >>        } catch (Exception e) {
> > >>            e.printStackTrace();
> > >>            return false;
> > >>        }
> > >>        return true;
>
> > >> On Dec 14, 12:11 pm, Amit Pandey  wrote:
> > >> > Just try creating session object using property object. May be it can
> > >> > help(Not sure).
>
> > >> > Properties props = new Properties();
> > >> >         Session session = Session.getDefaultInstance(props, null);
>
> > >> > On Tue, Dec 14, 2010 at 9:21 AM, Moretto  wrote:
> > >> > > Hi,
>
> > >> > > I'm using JAVAMAIL to send mail from my GAE app located at
> > >> > >http://k-share.appspot.com/.
>
> > >> > > I can't send email and no error occurs. The first time i've deployed
> > >> > > my app, it send 2 email then no more.
>
> > >> > > Take a look at the source code below:
>
> > >> > > /*
> > >> > >  * To change this template, choose Tools | Templates
> > >> > >  * and open the template in the editor.
> > >> > >  */
> > >> > > package com.appspot.kshare.control;
>
> > >> > > import com.google.appengine.api.users.User;
> > >> > > import com.google.appengine.api.users.UserService;
> > >> > > import com.google.appengine.api.users.UserServiceFactory;
> > >> > > import java.io.UnsupportedEncodingException;
> > >> > > 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;
>
> > >> > > /**
> > >> > >  *
> > >> > >  * @author malacma
> > >> > >  */
> > >> > > public class EmailControlUtil {
>
> > >> > >    public static boolean sendMail(String email, String destinatario,
> > >> > > String titulo, String texto, Object anexo) throws
> > >> > > Unsupporte

[appengine-java] Re: Not sending email with Javamail and no error

2010-12-16 Thread Moretto
"can send email messages on behalf of the app's administrators, and on
behalf of users with Google Accounts."

UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();

These two lines of code retrieve the current google user logged in.
i'll change it and test.

On Dec 17, 1:52 am, "A. Stevko"  wrote:
> I now recall the 
> conditions...http://code.google.com/appengine/docs/java/mail/overview.html
>
>
>
> > App Engine applications can send email messages on behalf of the app's
> > administrators, and on behalf of users with Google Accounts.
> On Thu, Dec 16, 2010 at 7:49 PM, A. Stevko  wrote:
> > Does the email address used in your From have administrator privileges for
> > your app?
>
> >            msg.setFrom(new InternetAddress(user.getEmail()));
>
> > I read somewhere that system could only send email from registered email
> > addresses.
>
> > On Thu, Dec 16, 2010 at 7:13 PM, Moretto  wrote:
>
> >> I've changed the code to initialize the Session object passing
> >> properties as a parameter. Nothing changed. Still does not send emails
> >> and doesnt throws any exception. Ideias??
>
> >>      Properties props = new Properties();
> >>        Session session = Session.getDefaultInstance(props, null);
>
> >>         UserService userService = UserServiceFactory.getUserService();
> >>        User user = userService.getCurrentUser();
> >>        try {
> >>            Message msg = new MimeMessage(session);
> >>            msg.setFrom(new InternetAddress(user.getEmail()));
> >>            msg.addRecipient(Message.RecipientType.TO,
> >>                    new InternetAddress(email, destinatario));
> >>            msg.setSubject(titulo);
> >>            msg.setText(texto);
> >>            Transport.send(msg);
>
> >>        } catch (AddressException e) {
> >>            e.printStackTrace();
> >>            return false;
> >>        } catch (MessagingException e) {
> >>            e.printStackTrace();
> >>            return false;
> >>        } catch (Exception e) {
> >>            e.printStackTrace();
> >>            return false;
> >>        }
> >>        return true;
>
> >> On Dec 14, 12:11 pm, Amit Pandey  wrote:
> >> > Just try creating session object using property object. May be it can
> >> > help(Not sure).
>
> >> > Properties props = new Properties();
> >> >         Session session = Session.getDefaultInstance(props, null);
>
> >> > On Tue, Dec 14, 2010 at 9:21 AM, Moretto  wrote:
> >> > > Hi,
>
> >> > > I'm using JAVAMAIL to send mail from my GAE app located at
> >> > >http://k-share.appspot.com/.
>
> >> > > I can't send email and no error occurs. The first time i've deployed
> >> > > my app, it send 2 email then no more.
>
> >> > > Take a look at the source code below:
>
> >> > > /*
> >> > >  * To change this template, choose Tools | Templates
> >> > >  * and open the template in the editor.
> >> > >  */
> >> > > package com.appspot.kshare.control;
>
> >> > > import com.google.appengine.api.users.User;
> >> > > import com.google.appengine.api.users.UserService;
> >> > > import com.google.appengine.api.users.UserServiceFactory;
> >> > > import java.io.UnsupportedEncodingException;
> >> > > 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;
>
> >> > > /**
> >> > >  *
> >> > >  * @author malacma
> >> > >  */
> >> > > public class EmailControlUtil {
>
> >> > >    public static boolean sendMail(String email, String destinatario,
> >> > > String titulo, String texto, Object anexo) throws
> >> > > UnsupportedEncodingException {
> >> > >        Session session = Session.getDefaultInstance(null);
>
> >> > >        UserService userService = UserServiceFactory.getUserService();
> >> > >        User user = userService.getCurrentUser();
> >> > >        try {
> >> > >            Message msg = new MimeMessage(session);
> >> > >            msg.setFrom(new InternetAddress(user.getEmail()));
> >> > >            msg.addRecipient(Message.RecipientType.TO,
> >> > >                    new InternetAddress(email, destinatario));
> >> > >            msg.setSubject(titulo);
> >> > >            msg.setText(texto);
> >> > >            Transport.send(msg);
>
> >> > >        } catch (AddressException e) {
> >> > >            e.printStackTrace();
> >> > >            return false;
> >> > >        } catch (MessagingException e) {
> >> > >            e.printStackTrace();
> >> > >            return false;
> >> > >        } catch (Exception e) {
> >> > >            e.printStackTrace();
> >> > >            return false;
> >> > >        }
> >> > >        return true;
> >> > >    }
> >> > > }
>
> >> > > Any ideia? Need help hurry :(
>
> >> > > --
> >> > > You received this message because you are subscribed to the Google
> >> Groups
> >>

Re: [appengine-java] Re: Not sending email with Javamail and no error

2010-12-16 Thread A. Stevko
I now recall the conditions...
http://code.google.com/appengine/docs/java/mail/overview.html

> App Engine applications can send email messages on behalf of the app's
> administrators, and on behalf of users with Google Accounts.



On Thu, Dec 16, 2010 at 7:49 PM, A. Stevko  wrote:

> Does the email address used in your From have administrator privileges for
> your app?
>
>
>msg.setFrom(new InternetAddress(user.getEmail()));
>
> I read somewhere that system could only send email from registered email
> addresses.
>
>
> On Thu, Dec 16, 2010 at 7:13 PM, Moretto  wrote:
>
>> I've changed the code to initialize the Session object passing
>> properties as a parameter. Nothing changed. Still does not send emails
>> and doesnt throws any exception. Ideias??
>>
>>  Properties props = new Properties();
>>Session session = Session.getDefaultInstance(props, null);
>>
>>
>> UserService userService = UserServiceFactory.getUserService();
>>User user = userService.getCurrentUser();
>>try {
>>Message msg = new MimeMessage(session);
>>msg.setFrom(new InternetAddress(user.getEmail()));
>>msg.addRecipient(Message.RecipientType.TO,
>>new InternetAddress(email, destinatario));
>>msg.setSubject(titulo);
>>msg.setText(texto);
>>Transport.send(msg);
>>
>>} catch (AddressException e) {
>>e.printStackTrace();
>>return false;
>>} catch (MessagingException e) {
>>e.printStackTrace();
>>return false;
>>} catch (Exception e) {
>>e.printStackTrace();
>>return false;
>>}
>>return true;
>>
>> On Dec 14, 12:11 pm, Amit Pandey  wrote:
>> > Just try creating session object using property object. May be it can
>> > help(Not sure).
>> >
>> > Properties props = new Properties();
>> > Session session = Session.getDefaultInstance(props, null);
>> >
>> >
>> >
>> > On Tue, Dec 14, 2010 at 9:21 AM, Moretto  wrote:
>> > > Hi,
>> >
>> > > I'm using JAVAMAIL to send mail from my GAE app located at
>> > >http://k-share.appspot.com/.
>> >
>> > > I can't send email and no error occurs. The first time i've deployed
>> > > my app, it send 2 email then no more.
>> >
>> > > Take a look at the source code below:
>> >
>> > > /*
>> > >  * To change this template, choose Tools | Templates
>> > >  * and open the template in the editor.
>> > >  */
>> > > package com.appspot.kshare.control;
>> >
>> > > import com.google.appengine.api.users.User;
>> > > import com.google.appengine.api.users.UserService;
>> > > import com.google.appengine.api.users.UserServiceFactory;
>> > > import java.io.UnsupportedEncodingException;
>> > > 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;
>> >
>> > > /**
>> > >  *
>> > >  * @author malacma
>> > >  */
>> > > public class EmailControlUtil {
>> >
>> > >public static boolean sendMail(String email, String destinatario,
>> > > String titulo, String texto, Object anexo) throws
>> > > UnsupportedEncodingException {
>> > >Session session = Session.getDefaultInstance(null);
>> >
>> > >UserService userService = UserServiceFactory.getUserService();
>> > >User user = userService.getCurrentUser();
>> > >try {
>> > >Message msg = new MimeMessage(session);
>> > >msg.setFrom(new InternetAddress(user.getEmail()));
>> > >msg.addRecipient(Message.RecipientType.TO,
>> > >new InternetAddress(email, destinatario));
>> > >msg.setSubject(titulo);
>> > >msg.setText(texto);
>> > >Transport.send(msg);
>> >
>> > >} catch (AddressException e) {
>> > >e.printStackTrace();
>> > >return false;
>> > >} catch (MessagingException e) {
>> > >e.printStackTrace();
>> > >return false;
>> > >} catch (Exception e) {
>> > >e.printStackTrace();
>> > >return false;
>> > >}
>> > >return true;
>> > >}
>> > > }
>> >
>> > > Any ideia? Need help hurry :(
>> >
>> > > --
>> > > 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> 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 fo

Re: [appengine-java] Re: Not sending email with Javamail and no error

2010-12-16 Thread A. Stevko
Does the email address used in your From have administrator privileges for
your app?

   msg.setFrom(new InternetAddress(user.getEmail()));

I read somewhere that system could only send email from registered email
addresses.


On Thu, Dec 16, 2010 at 7:13 PM, Moretto  wrote:

> I've changed the code to initialize the Session object passing
> properties as a parameter. Nothing changed. Still does not send emails
> and doesnt throws any exception. Ideias??
>
>  Properties props = new Properties();
>Session session = Session.getDefaultInstance(props, null);
>
>
> UserService userService = UserServiceFactory.getUserService();
>User user = userService.getCurrentUser();
>try {
>Message msg = new MimeMessage(session);
>msg.setFrom(new InternetAddress(user.getEmail()));
>msg.addRecipient(Message.RecipientType.TO,
>new InternetAddress(email, destinatario));
>msg.setSubject(titulo);
>msg.setText(texto);
>Transport.send(msg);
>
>} catch (AddressException e) {
>e.printStackTrace();
>return false;
>} catch (MessagingException e) {
>e.printStackTrace();
>return false;
>} catch (Exception e) {
>e.printStackTrace();
>return false;
>}
>return true;
>
> On Dec 14, 12:11 pm, Amit Pandey  wrote:
> > Just try creating session object using property object. May be it can
> > help(Not sure).
> >
> > Properties props = new Properties();
> > Session session = Session.getDefaultInstance(props, null);
> >
> >
> >
> > On Tue, Dec 14, 2010 at 9:21 AM, Moretto  wrote:
> > > Hi,
> >
> > > I'm using JAVAMAIL to send mail from my GAE app located at
> > >http://k-share.appspot.com/.
> >
> > > I can't send email and no error occurs. The first time i've deployed
> > > my app, it send 2 email then no more.
> >
> > > Take a look at the source code below:
> >
> > > /*
> > >  * To change this template, choose Tools | Templates
> > >  * and open the template in the editor.
> > >  */
> > > package com.appspot.kshare.control;
> >
> > > import com.google.appengine.api.users.User;
> > > import com.google.appengine.api.users.UserService;
> > > import com.google.appengine.api.users.UserServiceFactory;
> > > import java.io.UnsupportedEncodingException;
> > > 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;
> >
> > > /**
> > >  *
> > >  * @author malacma
> > >  */
> > > public class EmailControlUtil {
> >
> > >public static boolean sendMail(String email, String destinatario,
> > > String titulo, String texto, Object anexo) throws
> > > UnsupportedEncodingException {
> > >Session session = Session.getDefaultInstance(null);
> >
> > >UserService userService = UserServiceFactory.getUserService();
> > >User user = userService.getCurrentUser();
> > >try {
> > >Message msg = new MimeMessage(session);
> > >msg.setFrom(new InternetAddress(user.getEmail()));
> > >msg.addRecipient(Message.RecipientType.TO,
> > >new InternetAddress(email, destinatario));
> > >msg.setSubject(titulo);
> > >msg.setText(texto);
> > >Transport.send(msg);
> >
> > >} catch (AddressException e) {
> > >e.printStackTrace();
> > >return false;
> > >} catch (MessagingException e) {
> > >e.printStackTrace();
> > >return false;
> > >} catch (Exception e) {
> > >e.printStackTrace();
> > >return false;
> > >}
> > >return true;
> > >}
> > > }
> >
> > > Any ideia? Need help hurry :(
> >
> > > --
> > > 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 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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To p

[appengine-java] Re: Not sending email with Javamail and no error

2010-12-16 Thread Moretto
I've changed the code to initialize the Session object passing
properties as a parameter. Nothing changed. Still does not send emails
and doesnt throws any exception. Ideias??

  Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);


UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
try {
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(user.getEmail()));
msg.addRecipient(Message.RecipientType.TO,
new InternetAddress(email, destinatario));
msg.setSubject(titulo);
msg.setText(texto);
Transport.send(msg);

} catch (AddressException e) {
e.printStackTrace();
return false;
} catch (MessagingException e) {
e.printStackTrace();
return false;
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;

On Dec 14, 12:11 pm, Amit Pandey  wrote:
> Just try creating session object using property object. May be it can
> help(Not sure).
>
> Properties props = new Properties();
>         Session session = Session.getDefaultInstance(props, null);
>
>
>
> On Tue, Dec 14, 2010 at 9:21 AM, Moretto  wrote:
> > Hi,
>
> > I'm using JAVAMAIL to send mail from my GAE app located at
> >http://k-share.appspot.com/.
>
> > I can't send email and no error occurs. The first time i've deployed
> > my app, it send 2 email then no more.
>
> > Take a look at the source code below:
>
> > /*
> >  * To change this template, choose Tools | Templates
> >  * and open the template in the editor.
> >  */
> > package com.appspot.kshare.control;
>
> > import com.google.appengine.api.users.User;
> > import com.google.appengine.api.users.UserService;
> > import com.google.appengine.api.users.UserServiceFactory;
> > import java.io.UnsupportedEncodingException;
> > 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;
>
> > /**
> >  *
> >  * @author malacma
> >  */
> > public class EmailControlUtil {
>
> >    public static boolean sendMail(String email, String destinatario,
> > String titulo, String texto, Object anexo) throws
> > UnsupportedEncodingException {
> >        Session session = Session.getDefaultInstance(null);
>
> >        UserService userService = UserServiceFactory.getUserService();
> >        User user = userService.getCurrentUser();
> >        try {
> >            Message msg = new MimeMessage(session);
> >            msg.setFrom(new InternetAddress(user.getEmail()));
> >            msg.addRecipient(Message.RecipientType.TO,
> >                    new InternetAddress(email, destinatario));
> >            msg.setSubject(titulo);
> >            msg.setText(texto);
> >            Transport.send(msg);
>
> >        } catch (AddressException e) {
> >            e.printStackTrace();
> >            return false;
> >        } catch (MessagingException e) {
> >            e.printStackTrace();
> >            return false;
> >        } catch (Exception e) {
> >            e.printStackTrace();
> >            return false;
> >        }
> >        return true;
> >    }
> > }
>
> > Any ideia? Need help hurry :(
>
> > --
> > 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 > 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.