I have a legacy server that uses IMAP but does not support TLS. I am using stunnel and since implementation I am getting errors when an email has a larger attachment. My application process these attachments and when done (sometimes can
take 5-10 minutes) it marks the message for deletion. When all messages are completed it purges the emails from the box. My app is throwing an error when it tries to delete the message (see below). I think it may be due to stunnel closing the connection
to the server? Not quite sure.
javax.mail.FolderClosedException
at com.sun.mail.imap.IMAPMessage.getProtocol(IMAPMessage.java:105)
at com.sun.mail.imap.IMAPMessage.loadEnvelope(IMAPMessage.java:941)
at com.sun.mail.imap.IMAPMessage.getSubject(IMAPMessage.java:238)
at com.softlinx.docurouter.source.email.EmailSourceConnector.processMess
ages(EmailSourceConnector.java:1213)
at com.softlinx.docurouter.source.email.EmailSourceConnector.process(Ema
ilSourceConnector.java:1455)
at com.softlinx.docurouter.source.email.EmailSourceConnector.main(EmailS
ourceConnector.java:1622)
My configuration is pretty simple. I saw somewhere that I could put a timeoutidle on the connector but that does not seem to help. Any ideas are appreciated. Here is the config.
# Stunnel configuration file for Office 365 SMTP and POP3
# Author: MessageOps, www.messageops.com
# GLOBAL OPTIONS
client = yes
output = /etc/stunnel/stunnel-log.txt
debug=3
# taskbar=yes
# SERVICE-LEVEL OPTIONS
[POP3 Incoming]
accept = 110
connect = outlook.office365.com:995
timeoutidle = 14400
[SMTP Outgoing]
protocol = smtp
accept = 25
connect = outlook.office365.com:587
[IMAP]
accept = 143
connect = outlook.office365.com:993
timeoutidle = 14400
Here is a printout of the global options.
Global options:
debug = daemon.notice
pid = /var/run/stunnel.pid
RNDbytes = 64
RNDfile = /dev/urandom
RNDoverwrite = yes
Service-level options:
ciphers = FIPS (with "fips = yes")
ciphers = ALL:!SSLv2:!aNULL:!EXP:!LOW:-MEDIUM:RC4:+HIGH (with "fips = no")
curve = prime256v1
sessionCacheSize = 1000
sessionCacheTimeout = 300 seconds
sslVersion = TLSv1 (with "fips = yes")
sslVersion = TLSv1 for client, all for server (with "fips = no")
stack = 65536 bytes
TIMEOUTbusy = 300 seconds
TIMEOUTclose = 60 seconds
TIMEOUTconnect = 10 seconds
TIMEOUTidle = 43200 seconds
verify = none
-Ben