I have installed Postfix, Dovecot and MySQL via this tutorial (https://www.linode.com/docs/email/postfix/troubleshooting-problems-with-postfix-dovecot-and-mysql/).
When I do the following command, I get the following response:
$ openssl s_client -connect mail.domain.com:993
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.
I can login to my virtual accounts via the console, but when I'm using this PHP-script, it fails (the page keeps loading).
<?php
$mbox = imap_open("{mail.domain.com:993}", "user@domain.com", "password");
?>
When I run the dovecot -n command, I get the following output:
$ dovecot -n
# 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.13 (7b14904)
# OS: Linux 4.4.0-130-generic x86_64 Ubuntu 16.04.3 LTS
auth_debug = yes
auth_verbose = yes
log_path = /var/log/dovecot.log
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_privileged_group = mail
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
protocols = imap pop3 lmtp
service auth-worker {
user = vmail
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-userdb {
mode = 0600
user = vmail
}
user = dovecot
}
service imap-login {
inet_listener imap {
port = 0
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service pop3-login {
inet_listener pop3 {
port = 0
}
}
ssl = required
ssl_cert = </etc/dovecot/private/dovecot.crt
ssl_key = </etc/dovecot/private/dovecot.key
userdb {
args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
driver = static
}
I use the firewall 'ufw'.
$ ufw status
Status: active
To Action From
-- ------ ----
Apache Full ALLOW Anywhere
993 ALLOW Anywhere
995 ALLOW Anywhere
587 ALLOW Anywhere
OpenSSH ALLOW Anywhere
Dovecot POP3 ALLOW Anywhere
Dovecot Secure IMAP ALLOW Anywhere
Dovecot Secure POP3 ALLOW Anywhere
Postfix ALLOW Anywhere
Postfix SMTPS ALLOW Anywhere
Postfix Submission ALLOW Anywhere
Apache Full (v6) ALLOW Anywhere (v6)
993 (v6) ALLOW Anywhere (v6)
995 (v6) ALLOW Anywhere (v6)
587 (v6) ALLOW Anywhere (v6)
OpenSSH (v6) ALLOW Anywhere (v6)
Dovecot POP3 (v6) ALLOW Anywhere (v6)
Dovecot Secure IMAP (v6) ALLOW Anywhere (v6)
Dovecot Secure POP3 (v6) ALLOW Anywhere (v6)
Postfix (v6) ALLOW Anywhere (v6)
Postfix SMTPS (v6) ALLOW Anywhere (v6)
Postfix Submission (v6) ALLOW Anywhere (v6)
Is this a firewall problem? It seems like I only can connect from localhost, not from remote.
Thanks in advance.
PS: if you need more information, I'll be happy to share. But I don't know exactly the information you all need for this problem.
Edit: my SMTP server also does not work. I tested it with this (https://www.wormly.com/test-smtp-server) tool.
Output:
Resolving hostname...
Connecting...
Connection: opening to mail.domain.com:25, timeout=300, options=array (
)
Connection: opened
SERVER -> CLIENT: 220 mail.domain.com ESMTP Postfix (Ubuntu)
CLIENT -> SERVER: EHLO tools.wormly.com
SERVER -> CLIENT: 250-mail.domain.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 454 4.7.0 TLS not available due to local problem
SMTP ERROR: STARTTLS command failed: 454 4.7.0 TLS not available due to local problem
2018-07-07 17:06:08 SMTP Error: Could not connect to SMTP host.
CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 221 2.0.0 Bye
Connection: closed
2018-07-07 17:06:08 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Message sending failed.