I work in NIC (National Informatics Centre). When I try to send email thorugh my asp.net code, I am not abe to do so, reason most probably being the ports being blocked by our ISP. To confirm, I fired telnet command for ports 25, 465 and 587, but in all cases , I received the error "Could not connect". Is there any way to send email from my application inspite of the ports being blocked?

Recommended Answers

All 7 Replies

To get mail from your web application to an SMTP server, you'll need to have that communication path open. The target SMTP server is going to have a limited set of ports listening for SMTP traffic. Those are the ports that you can use to send mail. If your ISP blocks these ports, then you cannot send traffic on those ports to this target system.

You would have to find another target system that you can communicate with on a different port that your ISP allows you to send traffic on.

Thanks for replying. Is there any way I can find which ports are open for communication?

You can run a port scanner against the target machine but I would not suggest you do this without their knowledge or consent. port scanning is not usually well received. In any case, just knowing what ports are open is not going to satisfy your requirements. For exapmle, say the target server has port 80 open (because its running a web server). Sending mail to port 80 isnt going to do you any good since the application on that target server is not expecting SMTP packets.

Your first step is to determine what ports on the target server are used for SMTP services. Then figure out if your ISP allows traffic outbound from you to that server on the ports in question.

I would assume that your ISP has an SMTP server that they allow their customers to use? If so, send mail directly to that SMTP server (smart host). Let your ISP relay your mail.

Thank you so much!

Can I manually open ports?

A port, more specifically a socket (IP+port) is created by the app/service running on the host which will accepted traffic from clients. So opening a port means you start a program that establishes the socket.

You could always let the client do the work...

<a href="mailto:me@somewhere.com?subject=Mysubject">Mail Me</a>

OK it depends on them having an email client installed and you will have to monitor the account...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.