- 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:
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:
- In the terminal as root, I opened port 25 using iptables and Firewalld (but got the error that it's not in use)
- 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.
- Tools & Settings -> Mail Server Settings
- Checked the box for Enable mail management functions in Plesk
- Checked the box for Enable SMTP service on port 587 on all IP addresses
- Checked Turn on limitations on outgoing email messages
- Made all default limits to unlimited
- Kept checked: Allow users and scripts to use Sendmail
- Followed instructions here: https://support.plesk.com/hc/en-us/...ction-timed-out-and-25-Network-is-unreachable
- Accepted all other defaults
- Tools & Settings -> PHP Settings (8.1.27 FastCGI application is active) -> Plesk Installer. From there I:
- Temporarily disabled Selinux and Fail2Ban
- Kept Postfix and Dovecot installed and active
- Installed the Plesk Firewall
- 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
- In the PHP script, the mail function returned true, and the error_get_last() command returned null.
- Used ini_set("sendmail_path" ,""); as recommended here: PHP mail() function returns true, but doesn't send mail
- Also tried ini_set('smtp_port', 22)
- 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]
- 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
- 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:
- How to Send an E-mail from CentOS 7: A Step-by-Step Guide
- https://serverspace.us/support/help...m_campaign=google.com&utm_referrer=google.com
- Sending Email via PHP in CentOS 7 using Sendmail - Fasterland
- Does mailx send mail using an SMTP relay or does it directly connect to the target SMTP server?
- How to send email with my CentOS server?