3

I have an ASP.Net C# web application which sends out email notification. I configured it to use the SMTP server on our VPS to send the email. But if the application is not hosted on the VPS I get an error. The innermost exception message says:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xxx.xxx.xx.xxx:xx

If the application is hosted on the VPS, it works just fine.

I checked if the port is open on yougetsignal.com and it says port 25 is open. But using telnet (on my local machine) it says: Could not open connection to the host, on port 25: Connect failed. I also tried portchecktool.com on the VPS and it says Your ISP/Router/Firewall is not blocking port 25.

I have no idea what to do, can you help me out?

dunli
  • 131
  • 5

3 Answers3

4

As you are using this SMTP server for outgoing mail, configure authenticated Message Submission (RFC 6409) to port 587 with STARTTLS (or SMTPS to port 465). You should be able to use this from almost anywhere where the SMTP port 25 is blocked because the connection is not intended to be used for hosting a mail server. This doesn't affect SMTP connections out from your VPS.

Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122
  • How do I configure the port on Plesk? I already turned on Message Submission for all IP address (there is no input field for specifying ports), and it's working now on my unit but not on other outside machines. Server is using MailEnable btw. – dunli Jun 30 '18 at 08:57
  • I know nothing about Plesk, but [apparently](https://support.plesk.com/hc/en-us/articles/213372829-How-to-enable-587-submission-port-on-Linux-) the setting you are referring to uses standard port `587` by default. Web hosting control panels are off-topic here for a reason. – Esa Jokinen Jun 30 '18 at 09:13
  • I have a different settings visual, the article seems to be referring to Plesk Onyx or other version. I'm using Plesk 12.5.30. I only have the `Switch on message submission` setting – dunli Jun 30 '18 at 12:19
  • Now it doesn't work again on my local machine (which was working yesterday). XD – dunli Jun 30 '18 at 12:28
  • Sucks to be a Plesk user. ;) See your actual current configuration from command line. – Esa Jokinen Jun 30 '18 at 12:35
  • Yeah.. I'll just take it as part of my learning process since this is not in my field of expertise. But thanks anyways for your answer, I didn't mark it as answer tho coz adding the firewall rule solved my problem. I just posted my own answer for the sake of those who might encounter this problem. – dunli Jul 02 '18 at 15:01
2

Almost all personal internet service providers firewall port :25/tcp in the outwards direction. You need to connect using VPN or choose a corporate ISP contract.

Jonas Bjork
  • 376
  • 1
  • 4
  • So I can't use the SMTP server on the VPS outside of the VPS? – dunli Jun 29 '18 at 12:33
  • 1
    It depends on where you are connecting _from_. As I said, it's output blocked on the ISP level. If you're only using the SMTP server to send mail (not receive), then you could change the port to one of your choosing. – Jonas Bjork Jun 29 '18 at 12:51
0

Esa Jokinen's answer is actually the first step in solving my problem, I just missed to combine it all.

Prior to posting my question here, I was already experimenting on the MailEnable Management Console inbound port settings, ticked Listen on alternate port option under Submission Port and updated the port to 587 (default value was 49).

After taking Esa's advise, I turned on the Message Submission on Plesk but didn't add a firewall rule to allow port 587. So when I said I got it to work, I was actually using port 25 (maybe it slipped by the ISPs firewall that's why it didn't work the next day).

So the only thing I missed was adding a firewall rule to allow access to port 587.

enter image description here

dunli
  • 131
  • 5