Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Send email Google App Engine

    Hello everyone,

    I am getting the following error from my code that send email from Google App Engine

    Code:
    com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'mail' or call 'Send()' was not found.
    	at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:109)
    	at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:64)
    	at com.google.appengine.api.mail.MailServiceImpl.doSend(MailServiceImpl.java:101)
    	at com.google.appengine.api.mail.MailServiceImpl.send(MailServiceImpl.java:34)
    	at com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage(GMTransport.java:236)
    	at javax.mail.Transport.send(Transport.java:95)
    	at javax.mail.Transport.send(Transport.java:48)


    I've tried to use the solution suggested in this forum ...

    http://stackoverflow.com/questions/2...oyed-to-tomcat

    But without success!

    Please anyone who can suggest a solution, I will be grateful!

    This is my code in Java:


    Code:
    import java.io.UnsupportedEncodingException;
    import java.util.Properties;
    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;
    
    
    
    public class EmailJava {
    
        public EmailJava() {
    
        }
    
        public void enviaEmail() throws UnsupportedEncodingException {
            Properties props = new Properties();
            Session session = Session.getDefaultInstance(props, null);
    
            String Mensagem = "teste";
    
            try {
                Message msg = new MimeMessage(session);
                msg.setFrom(new InternetAddress("email@domain.com", "User"));
                msg.addRecipient(Message.RecipientType.TO, new InternetAddress("user@domain.com", "Mr. User"));
                msg.setSubject("Sua conta Example.com foi ativado");
                msg.setText(Mensagem);
                Transport.send(msg);
    
            } catch (AddressException e) {
                e.printStackTrace();
            } catch (MessagingException e) {
                e.printStackTrace();
            }
        }
    
    }
    Last edited by Linend; 24 Apr 2015, 15:09.
Working...
X