• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in sending email

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When i am sending email locally from the LAN, its working fine.

but when i upload it to static IP server it gave me following error:-
Sending failed; nested exception is: javax.mail.MessagingException: Could not connect to SMTP host: 80.227.102.42, port: 25; nested exception is: java.net.SocketException: Software caused connection abort: connect


Following is my code i am using to send email:

Properties props = new Properties();
props.put("mail.smtp.host", smpt);

// create some properties and get the default Session
Session session = Session.getDefaultInstance(props, null);
//session.setDebug(true);

// create a message
Message msg = new MimeMessage(session);

// set the from and to address
InternetAddress addressFrom = new InternetAddress(txtFrom);
msg.setFrom(addressFrom);
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(txtTo));

// Optional : You can also set your custom headers in the Email if you Want

// Setting the Subject and Content Type
msg.setSubject(txtSubject);
// start Imran
msg.setSentDate(new Date());
// end Mirza
msg.setContent(txtMessage, "text/html");
Transport.send(msg);



Thanks in advance.

regards, Imran
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you behind a proxy? Is 80.227.102.42 available on your LAN?
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
does the server accept connections from the domain you're trying to send from?
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the "Other Java APIs" forum, since the question is only about JavaMail, and doesn't really have anything to do with JSPs.
 
Imran Mirza
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, we are behind the proxy.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well JavaMail won't work from behind most proxies, since they are usually configured only to relay HTTP, not SMTP. Read the JavaMail FAQs.
 
Imran Mirza
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, but its running fine locally even we are behind proxy.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic