Graham,

"From" isn't your email account, "From" is "which half of your
application, the client, or the server?"

You can NOT send email from the client, but that so0und't like what
you're trying to do.

Greg

On Feb 28, 8:27 pm, Graham Haroldson <gharold...@gmail.com> wrote:
> Again,  im not quite sure what im trying to send emails from,  i can
> probably use my email, which is a gmail account.  I tried that and i also
> tried adding my account and password to the properties but it still does
> nothing
>
> On Mon, Feb 28, 2011 at 3:04 PM, Greg Dougherty
> <dougherty.greg...@mayo.edu>wrote:
>
> > > When i GWT Compile i get no errors at all.
>
> > GWT Compile is client side.  What you're doing is done, and can only
> > be done, on the server.  Where are you trying to send the mail from?
>
> > Greg
>
> > On Feb 28, 4:28 pm, GrahamH <gharold...@gmail.com> wrote:
> > > Hi all,
>
> > > Im trying to set up my GWT app so that it can send emails.
>
> > > I have the code to send the email in a server-side servlet class.  I
> > > have downloaded the Java Mail API and the JAF and included both the
> > > mail.jar and the activation.jar files to the external jars.
>
> > > Here is my Code:
>
> > > import java.util.Properties;
>
> > > import javax.mail.Message;
> > > import javax.mail.MessagingException;
> > > import javax.mail.Session;
> > > import javax.mail.Transport;
> > > import javax.mail.Message.RecipientType;
> > > import javax.mail.internet.AddressException;
> > > import javax.mail.internet.InternetAddress;
> > > import javax.mail.internet.MimeMessage;
> > > import javax.activation.*;
>
> > > import com.google.gwt.user.server.rpc.RemoteServiceServlet;
>
> > > import cs.ubc.ca.cs310.HockeyPool.client.EmailService;
>
> > > public class EmailServiceImpl extends RemoteServiceServlet implements
> > > EmailService  {
> > >         /**
> > >          *
> > >          */
> > >         private static final long serialVersionUID = 1L;
>
> > >         public void sendEmail(String email){
> > >                 Properties props = System.getProperties();
> > >                 props.put("mail.smtp.host", "smtp.gmail.com");
> > >                 props.put("mail.smtp.port", "465");
>
> > >                 Session mailSession = Session.getDefaultInstance(props);
> > >                 Message simpleMessage = new MimeMessage(mailSession);
>
> > >                 InternetAddress fromAddress = null;
> > >                 InternetAddress toAddress = null;
> > >                 try {
> > >                         fromAddress = new InternetAddress("
> > gharold...@gmail.com");
> > >                         toAddress = new InternetAddress(email);
> > >                 } catch (AddressException e) {
> > >                         // TODO Auto-generated catch block
> > >                         e.printStackTrace();
> > >                 }
>
> > >                 try {
> > >                         simpleMessage.setFrom(fromAddress);
> > >                         simpleMessage.setRecipient(RecipientType.TO,
> > toAddress);
> > >                         simpleMessage.setSubject("HockeyPool PoolAdmin
> > Invitation");
> > >                         simpleMessage.setText("Hello,<br /><br />You have
> > been added as a
> > > Pool Administrator for our Hockey Pool System");
>
> > >                         Transport.send(simpleMessage);
> > >                         System.out.println("email sent");
> > >                 } catch (MessagingException e) {
> > >                         // TODO Auto-generated catch block
> > >                         e.printStackTrace();
> > >                 }
> > >         }
>
> > > }
>
> > > When i GWT Compile i get no errors at all.
> > > Even when i debug the program it executes all of this code just fine
> > > and never hits an exception but the email is NEVER sent.
>
> > > Another thing is every single post about using Java Mail tells me i
> > > need the activation.jar but the following line gives me a warning that
> > > the activiation is never used anywhere in my class
>
> > > import javax.activation.*;
>
> > > Any help is much appreciated
> > > Thanks
>
> > --
> > 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to