This also happened to be Issue #6 in the troubleshooting guide ChatGPT created for me:
Troubleshoot “SMTP connect() failed”
The error “SMTP connect() failed” from PHPMailer (which ProjeQtOr uses for sending emails) means the app couldn't establish a connection with the SMTP server. It’s a common issue and usually fixable with some focused troubleshooting.
Here’s how to go about it, step by step:
1. Check SMTP Server Details
Make sure:
- SMTP host is correct (e.g., smtp.gmail.com, smtp.office365.com)
- Port is correct (587: STARTTLS, 465: SSL, 25: Non-encrypted and sometimes blocked by ISPs)
- SMTP username/password are valid and current
If you're using Gmail, you may need to use an App Password instead of your regular password (if 2FA is on).
2. Verify Encryption SettingsSet the encryption to match the SMTP server’s requirements:
- PHPMailer::ENCRYPTION_STARTTLS: Port 587
- PHPMailer::ENCRYPTION_SMTPS: Port 465
Mismatch = failure to connect.
3. Check for firewall or network blocking
Sometimes servers block outbound connections on SMTP ports.Check that:
- Outgoing traffic on port 587/465 is not blocked by a firewall
- Your hosting provider or sysadmin allows SMTP traffic
Use tools like telnet or openssl from the server:
telnet smtp.gmail.com 587
or
openssl s_client -connect smtp.gmail.com:465
If it fails here, it’s not a PHP/ProjeQtOr issue—it’s a network problem.
4. Enable Debugging in PHPMailer
You can enable debugging to get more info:
$mail->SMTPDebug = 2; // Or 3 for more detail
In ProjeQtOr, this may involve editing parameters.php or enabling verbose logging temporarily to capture the PHPMailer output.
5. Check PHP EnvironmentEnsure these PHP extensions are enabled:
openssl: required for secure connections
php-sockets
php-curl (sometimes used)
php-imap: required for ProjeQtOr to retrieve emails via IMAP
To check: e.g. “$ php -m | grep openssl”
6. Check for Hardcoded Configs
If you’re editing SMTP settings through the web interface, make sure parameters.php doesn’t override them. Sometimes the file has fixed values that prevent changes from taking effect.
7. Review PHPMailer's Wiki
PHPMailer's official troubleshooting page has lots of extra detail.
PHPMailer Troubleshooting Guide
github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
8. Special Cases
Gmail
- Enable "Less secure apps" (or use App Passwords if 2FA is enabled)
- Make sure your account isn’t being blocked for suspicious sign-ins
Office 365
- Must use SMTP Auth, TLS, and login credentials
- Sometimes requires admin permissions to send via SMTP
9. Common Pitfalls
- Wrong port: Match encryption type (TLS/SSL)
- Wrong host: Confirm hostname/IP of SMTP server
- Firewall blocking ports: Use telnet/openssl to test connection
- Invalid credentials: Confirm username and password (or App Password)
- PHP extensions missing: Make sure openssl and others are enabled