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.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to