File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes javax.mail.MessagingException: Unknown SMTP host: localhost:9090; Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "javax.mail.MessagingException: Unknown SMTP host: localhost:9090;" Watch "javax.mail.MessagingException: Unknown SMTP host: localhost:9090;" New topic
Author

javax.mail.MessagingException: Unknown SMTP host: localhost:9090;

guillermo luque
Greenhorn

Joined: Aug 03, 2002
Posts: 10
I developed a webapp that runs in a remote server and send E-mails when an event happen It was working for 4 weeks and out of blue I got an error.

javax.mail.MessagingException: Unknown SMTP host: localhost:9090;

I am using

- JBoss 4.2.3
- Mail Server: x2cpt.webappcabaret.net

My code is the following

String to = "thompsonluque@ymail.com"; // email that receive the feedback
String from = email; // email that send the feedback
String host = "www.myluque.com";
String stmp = "x2cpt.webappcabaret.net";

// Get system properties
Properties properties = System.getProperties();
// Setup mail server
properties.setProperty(stmp, host);
// Get the default Session object.//
Session session = Session.getInstance(properties, null);
try{
// Create a default MimeMessage object.
MimeMessage message = new MimeMessage(session);

// Set From: header field of the header.
message.setFrom(new InternetAddress(from));

// Set To: header field of the header.
message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));

// Set Subject: header field
message.setSubject(subject);

// Now set the actual message
message.setText(messagea);

// Send message
Transport.send(message);
System.out.println("Sent message successfully....");
}catch (MessagingException mex) {
mex.printStackTrace();
}

Please help

Thanks.



gigigigigigigigi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
properties.setProperty(stmp, host);

This line looks highly suspect to me, given the values of "stmp" and "host".

As an aside, the protocol is called SMTP, not STMP.


Android appsImageJ pluginsJava web charts
guillermo luque
Greenhorn

Joined: Aug 03, 2002
Posts: 10
Ulf Thanks for the quick response

I will check this code "properties.setProperty(stmp, host); "
and thank for the spelling SMTP.

But still the question why it worked fine for over three weeks.


guillermo luque
Greenhorn

Joined: Aug 03, 2002
Posts: 10
Hi

I did not change any code Only restart the server and now
The E-mail system is working.

Somebody has explanation.

Please reply
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: javax.mail.MessagingException: Unknown SMTP host: localhost:9090;
 
Similar Threads
Unable to send mail through mail api
JavaMail Problem at UNIX mail server
how to send email using Java Program?
SocketException with JavaMail
ClassNot found error