It looks to me that the SMTP works just fine, but after the message is sent it is being saved into the Sent folder over IMAP, and this IMAP connection fails. Enabling imap_debug and smtp_debug in Roundcube will produce some logs that might help to understand what's going on.