1

A CentOS 7 development server is used for prototyping webapps that send and receive email using JavaMail to connect with a remote mail server elsewhere on the internet. The remote mail server uses port 465 for smtp and port 993 for imap. Also, the local cable modem connecting the development server to the internet has blocked port 25.

I am reading quite a bit about this, and I think I need yum install postfix mailx dovecot on the development server. But all the google search results that I am finding seem to be related to building full fledged mail servers, when all I want to do is enable the web apps on a development web server to be able communicate with a remote mail server.

Am I going to be able to just yum install postfix dovecot mailx and have JavaMail be able to send and receive mail through port 465 and port 993 right away? Or will I have to take additional steps like setting up config files and creating/installing certificates, etc.?

I do not want to ask a broad question if there is a tutorial that can help me frame a narrower question. But so far the tutorials do not address this OP.

3
  • You should probably check the log files for any stunnel errors. – derobert Oct 19 '15 at 22:41
  • @derobert I just added the logs to the end of the OP, and also confirmed that the.mail.server.url is what I successfully type in MS Outlook for BOTH smtp and imaps. – CodeMed Oct 19 '15 at 23:06
  • @derobert This has become two questions. I would like to keep this question focused in case someone has a different answer than stunnel. By contrast, the stunnel offshoot has grown into a separate question. If you are please willing to help with it, the link is: unix.stackexchange.com/questions/237280/… – CodeMed Oct 19 '15 at 23:38
1

You'd only install procmail and dovecot if you want to turn the dev machine into a mail server. You don't need to install them to connect to remote mail servers.

  • 993/tcp is used for IMAP-over-SSL. If you can't get JavaMail to do that natively, you can use stunnel to perform the SSL/TLS part.
  • 465/tcp is used for SMTP-over-SSL. Same thing about stunnel.

Note that stunnel will let you statically configure talking to a few servers. You configure stunnel to listen on a port on localhost, and proxy to the remote server. Multiple remote servers/ports means multiple stunnel instances. Running a few instances is reasonable, but if you need to talk to arbitrary servers you'll need to figure out how to get JavaMail to do so. But that sounds like a programming question for Stack Overflow.

(BTW: As an alternative to 465/tcp support, you could configure a local mail server—such as postfix—and have JavaMail send email to the local server, then let that server handle talking to remote mail servers. But that's much more work, unless you really have to. And it makes error handling harder.)

3
  • Thank you. So then do my CentOS steps involve simply configuring the firewall and then installing/testing stunnel? Typing firewall-cmd --add-service=smtps --zone=public results in the error Error: INVALID_SERVICE: smtps. But firewall-cmd --add-service=imaps --zone=public works. Do I change the smtp.xml file to set the default port to 456? And then yum install stunnel and test with telnet to the mailserver before framing a JavaMail question if necessary on stack overflow? – CodeMed Oct 19 '15 at 21:55
  • @CodeMed I have no idea how firewall-cmd works. But I doubt you'd add it to a public zone, since the only connection to it will be from localhost. – derobert Oct 19 '15 at 21:56
  • Thank you. I just want a reliable way of confirming that stunnel is working. Are you willing to look at the EDIT to my OP – CodeMed Oct 19 '15 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.