Tuesday, September 28, 2010

Re: Sending mails from GWT-App

What does that mean?


On 28 Sep., 15:12, Paul Grenyer <paul.gren...@gmail.com> wrote:
> Hi
>
> This isn't a GET issue....
>
> Paul
>
> On Tue, Sep 28, 2010 at 1:46 PM, newnoise <tommmuel...@googlemail.com>wrote:
>
>
>
> > Hi,
>
> > I'm trying to send an email from my GWT-App. I found the following
> > code using google:
> > protected void sendMessage(String smtpHost, String fromAddress, String
> > fromName, String to, String subject, String text) {
> > // Get system properties Properties
> > props = System.getProperties();
> > // Setup mail server
> > props.put("mail.smtp.host", smtpHost);
> > // Get session
> > Session session = Session.getDefaultInstance(props, null);
> > // Define message
> > MimeMessage message = new MimeMessage(session);
> > // Set the from address
> > message.setFrom(new InternetAddress(fromAddress, fromName));
> > // Set the to address
> > message.addRecipient(Message.RecipientType.TO, new
> > InternetAddress(to));
> > // Set the subject
> > message.setSubject(subject);
> > // Set the content
> > message.setContent(text, "text/html");
> > // Send message
> > Transport.send(message);
> > }
>
> > But I'm getting a "java.lang.AssertionError: null".
>
> > I was wondering why I do not have to enter a password for the smtp-
> > server, and what to enter at String smtpHost, as I have to enter my
> > Smtp-Host at props.put() again ...
>
> > Thanks!
> > Tom
>
> > --
> > 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<google-web-toolkit%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> Thanks
> Paul
>
> Paul Grenyer
> e: paul.gren...@gmail.com
> b: paulgrenyer.blogspot.com
> t: pjgrenyer

--
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.

No comments:

Post a Comment