Announcement

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

    Send a email

    Hi,

    I'm trying to send a email using JAVA mail API.
    I downloaded the mail.jar and the activation.jar and put in classpath.
    However when i try to execute my code

    Code:
    public String register() {
    		
    		try {
    		// Setup mail server 
            Properties props = System.getProperties(); 
            props.put("mail.smtp.host", "pop3.gmail.com"); 
             
            // Get a mail session 
            Session session = Session.getDefaultInstance(props, null); 
             
            // Define a new mail message 
            Message message = new MimeMessage(session); 
            message.setFrom(new InternetAddress("from@gmail.com")); 
            message.addRecipient(Message.RecipientType.TO, new InternetAddress("to@gmail.com")); 
            message.setSubject("Some Subject"); 
            
            // Create a message part to represent the body text 
            message.setText("Some Message"); 
             
            // Send the message 
            Transport.send(message);
    		            
            } catch (Exception e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    	}


    I have the following error:

    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:70)
    	at com.google.appengine.api.mail.MailServiceImpl.doSend(MailServiceImpl.java:96)
    	at com.google.appengine.api.mail.MailServiceImpl.send(MailServiceImpl.java:33)
    	at com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage(GMTransport.java:247)
    	at javax.mail.Transport.send(Transport.java:95)

    Why is calling the Google AppEngine?
    Do i need more jars?

    Thanks in advance.

    #2
    Solved

    Hi again,

    Just solve my problem!
    I remove from the classpath all the JARS included in the Google App Engine SDK and it worked very well.

    Hope this could help others with the same problem.

    Bye.

    Comment


      #3
      If you are using eclipse and the google plugin wizard to create your project there is a check box you have to uncheck so that the appengine jars are not included.

      Comment


        #4
        Yes i know, thanks.

        I create my project with this option checked (by mistake).
        After i uncheck it, some jars stayed in the classpath and i had to remove them manually.

        Cheers.

        Comment


          #5
          Hey,

          I got exactly same problem. Nevertheless, i removed all jars included in google app engine sdk and i still have this error. Any ideas what might be cause ?

          Thx

          Comment


            #6
            Ok, i found the problem. I had some app engine jar in project that i haven't noticed before.

            Comment


              #7
              Hi all,

              I am also facing the same exception:

              Exception in thread "main" 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:95)
              at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:48)
              at com.google.appengine.api.mail.MailServiceImpl.doSend(MailServiceImpl.java:95)
              at com.google.appengine.api.mail.MailServiceImpl.send(MailServiceImpl.java:32)
              at com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage(GMTransport.java:247)
              at javax.mail.Transport.send(Transport.java:95)
              at javax.mail.Transport.send(Transport.java:48)
              at weatherForecast.SendEmail.main(SendEmail.java:40)

              If I remove the app engine jars,my web application deployed on the Google App Engine does not work. Is there any other way to get rid of this exception?

              Thanks in Advance!
              frustrated_techie

              Comment

              Working...
              X