Results 1 to 4 of 4
Thread: javax.mail.SendFailedException
- 01-19-2010, 07:12 AM #1
Member
- Join Date
- Feb 2009
- Posts
- 57
- Rep Power
- 0
javax.mail.SendFailedException
private static void fetchConfig() {
InputStream input = null;
try {
//If possible, one should try to avoid hard-coding a path in this
//manner; in a web application, one should place such a file in
//WEB-INF, and access it using ServletContext.getResourceAsStream.
//Another alternative is Class.getResourceAsStream.
//This file contains the javax.mail config properties mentioned above.
input = new FileInputStream( "C:\\Temp\\MyMailServer.txt" );
fMailServerConfig.load( input );
}
catch ( IOException ex ){
System.err.println("Cannot open and load mail server properties file.");
}
finally {
try {
if ( input != null ) input.close();
}
catch ( IOException ex ){
System.err.println( "Cannot close mail server properties file." );
here is the error:
Cannot open and load mail server properties file.
Cannot send email. javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25
i want to make a simple email program so i find some code but i get errors.
C:\\Temp\\MyMailServer.txt <<<==== i dont know mail server config but he mention about an "....alternative is Class.getResourceAsStream." how do i implement Class.getResourceAsStream and get rid of the above errors? tnx
- 01-19-2010, 11:20 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Those errors are next to useless.
You must print the stack trace, otherwise how on earth do you know where that exception was thrown from?
Anyway, presuming it's your file, does it exist at the location you've given?
- 01-20-2010, 02:30 PM #3
Member
- Join Date
- Feb 2009
- Posts
- 57
- Rep Power
- 0
sorry its not my file and i dont know the content of MyMailServer.txt, i just found the code on the net i tried to explore it hoping i would learn something but it doesnt run since a file is missing.. im looking for a simple java program that could send email.. i think i should look more.. tnx
- 01-20-2010, 02:53 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Similar Threads
-
problem with sending mail usin javaX.mail api
By sandeepsai39 in forum New To JavaReplies: 4Last Post: 11-25-2009, 05:37 AM -
javax.mail.Transport
By sharpi03 in forum Advanced JavaReplies: 5Last Post: 10-23-2009, 05:26 PM -
javax.mail.SendFailedException: Invalid Addresses;
By Anju Jose in forum Advanced JavaReplies: 2Last Post: 03-08-2009, 12:29 AM -
Javax.mail.MethodNotSupported Exception in java mail api
By namarc in forum Advanced JavaReplies: 2Last Post: 05-05-2008, 06:01 AM -
I can't import javax.mail
By katie in forum New To JavaReplies: 2Last Post: 08-04-2007, 05:05 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks