• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Can't open Port 25. Please help

mhogue

New Pleskian
Server operating system version
CentOS Linux release 7.9.2009 (Core)
Plesk version and microupdate number
Web Host Edition Version 18.0.59 Update #2
Hey Friends,

I'm an intermediate CentOs user, but feel like a total beginner with Plesk. I've tried numerous wiki's and a few discussions in this forum, wasted a full day on this issue, and really hope that someone can help out.

My goal is to get php to send an email to an email address. I've tried many things, so will try to summarize the most important details:
  1. In the terminal as root, I opened port 25 using iptables and Firewalld (but got the error that it's not in use)
  2. In Plesk, went to Websites and Domains, clicked on the Mail tab, then Mail Settings. Activated the Enabled radio, and then accepted most of the details (not planning to read email on this server, so disabled a couple obvious choiced) and Applied Changed.
  3. Tools & Settings -> Mail Server Settings
    1. Checked the box for Enable mail management functions in Plesk
    2. Checked the box for Enable SMTP service on port 587 on all IP addresses
    3. Checked Turn on limitations on outgoing email messages
    4. Made all default limits to unlimited
    5. Kept checked: Allow users and scripts to use Sendmail
    6. Followed instructions here: https://support.plesk.com/hc/en-us/...ction-timed-out-and-25-Network-is-unreachable
    7. Accepted all other defaults
  4. Tools & Settings -> PHP Settings (8.1.27 FastCGI application is active) -> Plesk Installer. From there I:
    1. Temporarily disabled Selinux and Fail2Ban
    2. Kept Postfix and Dovecot installed and active
    3. Installed the Plesk Firewall
      1. Accepted most of the detail configurations, except: Restricted SSH access to my local IP address, and Created a new rule to open port 25 for outgoing traffic
  5. In the PHP script, the mail function returned true, and the error_get_last() command returned null.
  6. Used ini_set("sendmail_path" ,""); as recommended here: PHP mail() function returns true, but doesn't send mail
  7. Also tried ini_set('smtp_port', 22)
  8. Inspected /var/log/maillog . using tail maillog, the response either showed that the connection timed out or that port 25 was blocked or the network was unreachable. Most entries in the log showed a postfix code: postfix/smtp[16269], postfix/smtp[16270]
  9. Tried to telnet into my server from my mac shell on port 25, and also to telnet to google on port 25, as suggested here: Emails are not sent from a Plesk server with the errors “25: Connection timed out” and “25: Network is unreachable” - Support Cases from Plesk Knowledge Base
  10. Attempted to send mail using the linux shell directly. In each case, the email was not delivered, and the log file showed a similar error message. To do this, I referenced and followed instructions here:
    1. How to Send an E-mail from CentOS 7: A Step-by-Step Guide
    2. https://serverspace.us/support/help...m_campaign=google.com&utm_referrer=google.com
    3. Sending Email via PHP in CentOS 7 using Sendmail - Fasterland
    4. Does mailx send mail using an SMTP relay or does it directly connect to the target SMTP server?
    5. How to send email with my CentOS server?
At this point, I don't know what else to try. How do I open port 25? I didn't know if could be so difficult to get php to send an email. Any help would be VERY appreciated.
 
Some data centers block port 25 by default, so it might not be blocked on your server, but in a firewall at your data center. Have you already contacted them on the issue?
 
Back
Top