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 <andy.ste...@gmail.com> 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 <mala...@gmail.com> 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 <amit.s...@gmail.com> 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 <mala...@gmail.com> 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<google-appengine-java%2bunsubscr...@googlegroups.com><google-appengine-java%2B
>> 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<google-appengine-java%2bunsubscr...@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.

Reply via email to