473,385 Members | 1,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

cannot connect to smtp host

254 100+
i know alot of people faced this problem before.
i searched google.com i search javaranch.com, no one article can help me solve the problem.
I runs it in my localhost server, it runs well.
But when i runs it in my company's server, it give this error :
----
javax.mail.SendFailedException: Sending failed; nested exception is: class javax.mail.MessagingException: Could not connect to SMTP host: mail.as.com.my, port: 25; nested exception is: java.net.ConnectException: Connection timed out: connect
----

i used telnet to ping the mail server, it was okay and give me 220. This is in localhost.
But when i try to telnet the mail server in company's remote pc, it said cannot open a connection to host on port 25

could someone list down the possible causes so that i and everyone else can know how many possible causes for this problem.

I'll really appreciate if someone can help..
thanks in advance.

~Nick

Expand|Select|Wrap|Line Numbers
  1.  
  2. String message = "halo" + " world";
  3. Properties props = new Properties();
  4. props.put("mail.smtp.port", "25");
  5. props.put("mail.smtp.host","mail.as.com.my");
  6.  
  7.  
  8. // create some properties and get the default Session
  9. Session ss = Session.getInstance(props, null);
  10. ss.setDebug(true);
  11.  
  12.  
  13. MimeMessage msg = new MimeMessage(ss);
  14.  
  15. InternetAddress addressfrom = new InternetAddress("info@as.com.my");
  16. msg.setFrom(addressfrom);
  17.  
  18. InternetAddress addressTo = new InternetAddress(to);
  19. msg.addRecipient(Message.RecipientType.TO, addressTo);
  20.  
  21. msg.setSubject(subject);
  22. msg.setContent(message, "text/plain");
  23.  
  24. Transport.send(msg);
  25.  
Aug 17 '07 #1
3 5648
Well, I can't telnet the host either. You might wanna check if its domain name is properly registered.
Try using ip number in your code...
Before I tried this one of my guesses was that your company network might be blocking trafic over port 25. You might check that too, but I think DNS is the problem.
Aug 17 '07 #2
JosAH
11,448 Expert 8TB
Well, I can't telnet the host either. You might wanna check if its domain name is properly registered.
I guess the OP doesn't want to shows us the real name of his/her smtp server;
I don't recognize the top level domain name of "mail.as.com.my"; and indeed
it can't be ping'd nor telnet'd at all.

kind regards,

Jos
Aug 18 '07 #3
nickyeng
254 100+
I guess the OP doesn't want to shows us the real name of his/her smtp server;
I don't recognize the top level domain name of "mail.as.com.my"; and indeed
it can't be ping'd nor telnet'd at all.

kind regards,

Jos
yeah, you're right.
i didn't show the correct name.

by the way, i settled this problem already.
My company block on port 25 and any connection to it.
It is settled using my director's mail code.

thanks anyway.
Aug 22 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Dan Boyle | last post by:
Hi, I am having difficulty connection to an smtp host. I am using the following code but I don't think I fully understand what smtp host can be used. function setSMTPParams($host = null,...
8
by: JZ | last post by:
I cannot find out what is the problem with my Python. I cannot join to smtp host. > python Python 2.3.4 (#1, Jun 22 2004, 04:42:42) on linux2 Type "help", "copyright", "credits" or "license"...
2
by: Miki Tebeka | last post by:
Hello All, I can't connect to our Excahnge server using smtplib from a WinXP box. Connection to the same server from a Linux box works. The code: from smtplib import SMTP s =...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
5
by: Chris | last post by:
I am trying to send email in C#. I wrote 2 pieces of code: 1. MailMessage mail = new MailMessage(); mail.From = "from_address"; mail.To = "to_address"; mail.Subject = "subject"; mail.BodyFormat...
5
by: =?Utf-8?B?bW9tbw==?= | last post by:
Hello, I've been having a prlbem sending an email using ASP.net 2.0 I can send an email if “To” address is hotmail, gmail or yahoo but not other addresses. Does anyone know how I can...
1
by: ynyus75 | last post by:
Hey! I am unable to connect some of the services that I host from my laptop at home, such as SMTP and MySQL on port numbers 25 and 3306 respectively. But I am able to some services such as...
0
by: Homer | last post by:
Hi, I got "InnerException: Unable to connect to remote server"..."No connection could be made because the target machine actively refused it" when I attempted to send an email through my...
3
by: =?Utf-8?B?U3JpZGhhcg==?= | last post by:
Hi, I have created a windows application to send the emails. Following is the code I am using. Dim errMsg As String Dim ToAddress As String Dim FromAddress As String Try ToAddress =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.