Hello, I am using Mail Server 4.6 which is install from the App Store. Thank you for the great application!
Upon following this guide, https://doc.aapanel.com/web/#/3?page_id=178 , I am able to setup the mail server for my primary domain ( domain1.com ) and send emails normally in SSL Mode
However, I have many domains and sub-domains that need email service. Only the first added domain is working while the other domain and sub-domains fail.
Here is some background of my aaPanel structure.
Domains
- domain1.com
- domain2.com
- sub.domain1.com
Environment:
OS: Linux CentOS7
IP: 1.1.1.1
PHP: 7.2 / 7.4 / 8.0
DNS: cloudflare
Steps:
For the first domain, domain1.com, I just follow the instruction and set up.
- MX domain1.com mail.domain1.com 10
- TXT @ (SPF copied)
- TXT default._domainkey (DKIM copied)
- TXT _dmarc (DMARC copied)
- A mail 1.1.1.1 (Proxy disabled)
Then all records are verify with all green ticks on the panel.
Then I applied SSL and copied to the mail server panel
Then added email accounts.
Final SMTP:
- SMTP Host: mail.domain1.com
- SMTP Port: 465
- SMTP username: email created in "add user"
- SMTP password: email created in "add user"
First domain is fine. But when I add the second domain, domain2.com, the second one fails.
Steps to add second domain:
I click the add domain button on the panel's left upper corner and type:
Domain name: domain2.com
A record: mail.domain2.com
In domain2.com DNS zone:
- MX domain2.com mail.domain2.com 10 (also tried with mail.domain1.com)
- TXT @ (SPF copied)
- TXT default._domainkey (DKIM copied)
- TXT _dmarc (DMARC copied)
- A mail 1.1.1.1 (Proxy disabled)
Then all records are verify with all green ticks on the Mail Server panel.
Then added domain2.com and mail.domain2.com to the server in website tab of aaPanel
Then applied pan domain SSL for domain2.com and copied to Mail Server panel.
Final SMTP:
- SMTP Host: mail.domain2.com (also tried with mail.domain1.com)
- SMTP Port: 465
- SMTP username: email2 created in "add user"
- SMTP password: password2 created in "add user"
I use WordPress SMTP plugin (WP Mail SMTP) to test because this works on many of my other websites with cPanel mail server.
Errors:
`Versions:
WordPress: 5.9.3
WordPress MS: No
PHP: 7.4.20
WP Mail SMTP: 3.4.0
Params:
Mailer: smtp
Constants: No
ErrorInfo: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Host: mail.domain2.com
Port: 465
SMTPSecure: ssl
SMTPAutoTLS: bool(true)
SMTPAuth: bool(true)
Server:
OpenSSL: OpenSSL 1.0.2u 20 Dec 2019
Debug:
Email Source: WP Mail SMTP
Mailer: Other SMTP
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
SMTP Debug:
2022-05-24 00:47:10 Connection: opening to ssl://mail.doamin2.com:465, timeout=300, options=array()
2022-05-24 00:47:10 Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed [/www/wwwroot/domain2.com/wp-includes/PHPMailer/SMTP.php line 388]
2022-05-24 00:47:10 Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [/www/wwwroot/domain2.com/wp-includes/PHPMailer/SMTP.php line 388]
2022-05-24 00:47:10 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://mail.3dayseo.com:465 (Unknown error) [/www/wwwroot/domain2.com/wp-includes/PHPMailer/SMTP.php line 388]
2022-05-24 00:47:10 SMTP ERROR: Failed to connect to server: (0)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting`