Hello Henning,

Thanks for your reply.

here is my full code with which i am trying to send  email from Google
app engine.

import java.io.IOException;
import java.io.PrintWriter;
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;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TestMail extends HttpServlet {

         private static final String emailMsgTxt = "My first java
mail";

        private static final String emailSubjectTxt = "A test from gmail";

       //Here sowjanya is my appid and my email address is
sowji.ap...@gmail.com

        private static final String emailFromAddress =
"sowji.ap...@sowjanya.appspot.com";

        private static final String[] sendTo ={ "sowji.ap...@gmail.com" };

        private static final long serialVersionUID = 1L;

        public void doGet(HttpServletRequest req, HttpServletResponse resp)
                                                         throws IOException {

                        PrintWriter pw=resp.getWriter();

                           resp.setContentType("text/plain");

                           try{

                                boolean debug = true;

                                     Properties props = new Properties();

                             Session
session=Session.getDefaultInstance(props,null);

                                session.setDebug(debug);

                                Message msg = new
MimeMessage(session);

                                InternetAddress addressFrom = new
InternetAddress(emailFromAddress);

                                 msg.setFrom(addressFrom);

                                 InternetAddress[] addressTo = new
InternetAddress[sendTo.length];

                                 for (int i = 0; i < sendTo.length; i+
+) {

                                          addressTo[i] = new
InternetAddress(sendTo[i]);

                                  }
 
msg.addRecipients(Message.RecipientType.TO, addressTo);

                                 msg.setSubject(emailSubjectTxt );

                                 msg.setContent( emailMsgTxt , "text/
plain");

                                 Transport.send(msg);

                                      pw.println("sent successfully");
                  }
                catch(AddressException ae){

                        System.out.println(ae.getMessage());
                }
                catch(MessagingException me){

                        System.out.println(me.getMessage());
                }
                  catch(Exception e){

                        System.out.print(e.getMessage());

                  }
            }
        }


With this code i can't get any errors or emails.

Is this topic need any setups in any file.please tell me clearly.

My doubt is that,how can google app engine send mails with out any
authentication checking for from address.


Please, help me.
Thanks,
Lakshmi.
On Feb 17, 11:34 pm, Henning <henning2...@hotmail.de> wrote:
> Hello,
>
> I have the same problem, but it is not about the favicon.
> It is about getting app engine to send through smtp.googlemail.com an
> email.
> Is this possible ?
>
> Are these props ever considered by Transport.send ??
>
> >         props.put("mail.smtp.host","smtp.gmail.com");
>
> >         props.put("mail.smtp.username","sowji.apr10");
>
> >         props.put("mail.smtp.PASSWORD","smtp.gmail.com");
>
> My app only sends emails if I use setFrom(*) inserting an app admin,
> developer or a some...@myapp.appspot.com  address.
>
> Best regards,
> Henning
>
> On Feb 11, 1:32 pm, Sowji <sowji.ap...@gmail.com> wrote:
>
>
>
> > Hi, i am trying to send a mail with google app engine wuth java.
>
> > My code is,
>
> >       Properties props =*new* Properties();
>
> >         props.put("mail.smtp.host","smtp.gmail.com");
>
> >         props.put("mail.smtp.username","sowji.apr10");
>
> >         props.put("mail.smtp.PASSWORD","smtp.gmail.com");
>
> >           Session session = Session.*getDefaultInstance*(props, *null*);
>
> >         String msgBody = "Hai this is my first mail through java
> > programming";
>
> > *        try* {
>
> >                     Message msg=*new* MimeMessage(session);
>
> >                     msg.setText("hai......."+msgBody);
>
> >                     msg.setSubject("First Message from java");
>
> >                     msg.setFrom(*new* InternetAddress(my...@gmail.com));
>
> > msg.setRecipient(Message.RecipientType.*TO*,*new*InternetAddress(
> > "my...@gmail.com"));
>
> >                     Transport.*send*(msg);
>
> >                     PrintWriter pw=resp.getWriter();
>
> >                     pw.println("<html></body>mail is
> > seding.......</body></html>");
>
> >             }
>
> > *        catch*(AddressException adde){
>
> >                     //   System.*out*.print("error in address");
>
> >                 }
>
> > *        catch*(MessagingException mse){
>
> >                        // System.*out*.print("error in messaging");
>
> >                 }
> >   For this code i did not get any mail or any errors  as reply.
>
> >  My console print warning like this,
>
> > The server is running athttp://localhost:3624/
>
> > Feb 11, 2010 12:22:58 PM
> > com.google.appengine.tools.development.LocalResourceFileServlet doGet
>
> > WARNING: No file found for: /favicon.ico
>
> > Feb 11, 2010 12:23:00 PM
> > com.google.appengine.tools.development.LocalResourceFileServlet doGet
>
> > WARNING: No file found for: /favicon.ico
>
> >  Please help me to solve this problem.
>
> > Thanks,
>
> > Lakshmi.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to