I think you need to learn a bit more about how email works before
trying to do that.
For the record, gmail.com is an http server not a smtp one.
If you don't want to bother learning about email protocols, I suggest
you try smtp.gmail.com instead of 209.85.171.83

Cheers,

Salvador



On May 11, 2:06 pm, abhiram <abhir...@gmail.com> wrote:
> Hi all,
>
>   I am writing an application to send an email from the server side. I
> am using the mail.jar for this purpose. I have written a function for
> this as below:
>
> protected void sendMessage(String smtpHost, String fromAddress, String
> fromName, String to, String subject, String text) throws
> UnsupportedEncodingException, MessagingException
>          {
>                 System.out.println("ABC");
>           // Get system properties
>           Properties props = System.getProperties();
>           // Setup mail server
>           props.put("mail.smtp.host", smtpHost);
>           // Get session
>           javax.mail.Session session = javax.mail.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);
>          }
>
> and i am invoking the function using this line of code.
>
> sendMessage("209.85.171.83", "abhir...@gmail.com", "abhiram",
> "abhir...@gmail.com", "Hi", "Message-Body");
>
> Here, i found the ip address is of gmail.com which i got by pinging
> for gmail.com. Please let me know if this approach is right as I am
> getting an error like "Could not connect to SMTP host : 66.249.93.109,
> port:25 ".
>
> Thanks and Regards,
> Abhiram
--~--~---------~--~----~------------~-------~--~----~
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