Posts Tagged ‘Dovecot’

Dovecot IMAP SquirrelMail Cannot Append Error

Saturday, May 31st, 2008

If you’re a user of SquirrelMail and Dovecot 1.x, you may run across this error “ERROR: Bad or malformed request. Server responded: Error in IMAP command APPEND:” after sending a message. The composed email message still sends, but you get that annoying error. I don’t know exactly what caused it other than a possible Dovecot upgrade, but nevertheless, this is how to alter SquirrelMail to resolve the issue.

In the functions directory of your SquirrelMail install, open the imap_general.php file.

Alter the sqimap_append PHP function by commenting out the line that starts with the fputs function and type in the replacement so it reads as:

function sqimap_append ($imap_stream, $sent_folder, $length) {
//    fputs ($imap_stream, sqimap_session_id() . " APPEND \"$sent_folder\" (\\Seen) \{$length}\r\n");
    fputs ($imap_stream, sqimap_session_id() . " APPEND \"$sent_folder\" (\\Seen) {" . $length . "}\r\n");
    $tmp = fgets ($imap_stream, 1024);
    sqimap_append_checkresponse($tmp, $sent_folder);
}

Save the changes and the problem should be solved. FYI: Upgrading to the latest version of SquirrelMail will resolve this issue as well, but applying this code change is less of a hassle.

Fix Source: XMail Forum -> dovecot imap cannot append