I have successfully setup an email server for myself using this DO tutorial for Postfix, Dovecot, MySQL, and RoundCube. I skipped spamassasin. Everything works fine, I can send and receive emails, and manage them through roundcube or my iphone.
But now I have spent 8 hours on this PHP problem, here’s the simplest I can reproduce it…
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$mbox = imap_open("{localhost:143/imap}", "john@example.com", "johnspassword", OP_HALFOPEN);
?>
Gives the errors
Warning: imap_open(): Couldn't open stream {localhost:143/imap} in /var/www/example.com/public_html/test.php on line 6
Notice: Unknown: Connection failed to localhost,143: Connection refused (errflg=2) in Unknown on line 0
That is the error that shows for the php output. I can’t seem to find a log file with the same information. All I want is to connect to my emails.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello friend!
This is definitely an interesting one because from the way it sounds on one end, IMAP services are up and running. From the other end, sounds like they may not be. There’s some clear disconnect there, so perhaps the configuration is more complex than average.
I would install telnet on the server and run this: telnet localhost 143
It’s just a quick way to see what you get when connecting to the port to/from localhost. A firewall entry could be blocking the internal connection (odd but possible). I can’t think of what else it could be, to be honest, that would cause external connections to succeed and internal ones to fail in relation to dovecot.
Kind Regards, Jarland
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.