Saturday, March 19, 2011

Re: How to send an Email with GWT to a specific Address?

Do you have mail and activation jars in WEB-INF/lib ?

2011/3/18 antrox <yrk@live.de>:
> Hello,
>
> this is what i tried for testing only.
>
> have a look please, pretty simple i guess.
>
> I made a Button which performs this:
>
>        public void sendmail(){
>                rpcService.sendingnow(new AsyncCallback<Boolean>() {
>                        public void onSuccess(Boolean result) {
>                        }
>                                     ....
>        }
>
>        public Boolean sendingnow(){
>                try {
>                        sendingnow2();
>                } catch (UnsupportedEncodingException e) {
>                        e.printStackTrace();
>                }
>                return true;
>        }
>
>        public void sendingnow2() throws UnsupportedEncodingException{
>             Properties props = new Properties();
>                Session session = Session.getDefaultInstance(props, null);
>
>                String msgBody = "kk works";
>
>                try {
>                    Message msg = new MimeMessage(session);
>                    msg.setFrom(new
> InternetAddress("peter_listewnik@hotmail.com", "lol"));
>                    msg.addRecipient(Message.RecipientType.TO,
>                                     new InternetAddress("piotr.listewnik@uni-
> oldenburg.de", "kkk"));
>                    msg.setSubject("funktioiert!");
>                    msg.setText(msgBody);
>                    Transport.send(msg);
>
>                } catch (AddressException e) {
>                } catch (MessagingException e) {
>                }
>        }
>
>
> ___________
>
> this is the error i get:
>
> [WARN] Exception while dispatching incoming RPC call
> com.google.gwt.user.server.rpc.UnexpectedException: Service method
> 'public abstract java.lang.Boolean swp.client.LCService.sendingnow()'
> threw an unexpected exception: com.google.apphosting.api.ApiProxy
> $CallNotFoundException: The API package 'mail' or call 'Send()' was
> not found.
>
>
>
>
> First of all. Am I doing it correctly? And i really dont know how to
> include another Library, this is the problem i think.
>
> how can i fix it?
>
> tank you.
>
> best regards
>
> On 14 Mrz., 06:21, wingdings <dush...@gmail.com> wrote:
>> To send an email message, an app prepares a MimeMessage object, then sends
>> it with the static method send() on the Transport class. The message is
>> created using a JavaMail Session object. The Session and the Transport work
>> with the App Engine Mail service without any additional configuration.
>>
>> 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;
>>
>> // ...
>>         Properties props = new Properties();
>>         Session session = Session.getDefaultInstance(props, null);
>>
>>         String msgBody = "...";
>>
>>         try {
>>             Message msg = new MimeMessage(session);
>>             msg.setFrom(new InternetAddress("ad...@example.com", "Example.com Admin"));
>>             msg.addRecipient(Message.RecipientType.TO,
>>                              new InternetAddress("u...@example.com", "Mr. User"));
>>             msg.setSubject("Your Example.com account has been activated");
>>             msg.setText(msgBody);
>>             Transport.send(msg);
>>
>>         } catch (AddressException e) {
>>             // ...
>>         } catch (MessagingException e) {
>>             // ...
>>         }
>>
>> watch outhttp://code.google.com/appengine/docs/java/mail/usingjavamail.html
>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate