IMAP problem -- Failed to write to socket: not connected (code: -1)

linuxChique

Member
Aug 16, 2010
8
0
51
I'm having email problems with webmail and IMAP. When I try to send email with Horde, I get this: There was an error sending your message: Failed to set sender: [email protected] [SMTP: Failed to write to socket: not connected (code: -1, response: )]. I have read elsewhere that this is due to SMTP being blocked in csf, but I followed the instructions to set those to allow SMTP traffic:

Code:
SMTP_BLOCK = "0"
SMTP_ALLOWLOCAL = "1"
There's also:

Code:
SMTP_PORTS = "25"
SMTP_ALLOWUSER = "cpanel"
SMTP_ALLOWGROUP = "mail,mailman"
Anyway, stopping csf altogether doesn't fix the problem.

When I try to send an email, I get this in /var/log/maillog:

Code:
Jul 18 19:30:54 hadrian imapd: LOGIN, [email protected], ip=[::ffff:127.0.0.1], port=[45588], protocol=IMAP
Jul 18 19:30:55 hadrian imapd: LOGOUT, [email protected], ip=[::ffff:127.0.0.1], headers=0, body=0, rcvd=38, sent=250, time=1
I need to get email working. What else can I try?
 

Infopro

Well-Known Member
May 20, 2003
17,085
521
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
Sounds like you're logged into cPanel as the cPanel user and then went to Webmail as that user and tried to send an email. The cPanel user doesn't actually have an email account though. Create an email account properly and logout of cPanel.

Log back into Webmail yourdomain.com/webmail using that new email account you just created. Your Webmail login would be the full email address for the username, and the password you set that new email account to have. Now try sending an email and see how it goes.
 

santrix

Well-Known Member
Nov 30, 2008
225
2
68
Was there a simple fix for this?

I am seeing the same issue on one of our servers. I setup my own mailbox in a customer's account, and then (using a different browser), logged in via domain/webmail using the mailbox address/password. Upon trying to send a message to anyone (a domain on the same server, or somewhere else entirely) using Horde I see

There was an error sending your message: Failed to set sender: [email protected] [SMTP: Failed to write to socket: not connected (code: -1, response: )]
 

Infopro

Well-Known Member
May 20, 2003
17,085
521
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
When you open webmail and go to send a new message, at top of that window does it show the Identity you'll be using to send that email?

In the ticket mentioned above, EXIM was not running for some reason. Are you able to send email out from any other accounts on the same server or no?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
41
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Also, if the issue is exim isn't running, check for that and restart it:

Code:
ps aux | grep exim
/etc/init.d/exim restart
After it is running, tail /var/log/exim_mainlog to see if you show any errors occurring on startup:

Code:
tail -fn0 /var/log/exim_mainlog
Thanks!