- /* Message has been committed to the store, so delete it from the remote server */
- snprintf(buf, sizeof buf, "DELE %d\r", msglist[i]);
- lprintf(CTDL_DEBUG, "<%s\n", buf);
- if (sock_puts(sock, buf) <0) goto bail;
- if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
- lprintf(CTDL_DEBUG, ">%s\n", buf);
- if (strncasecmp(buf, "+OK", 3)) goto bail;
+ /* Message has been committed to the store */
+
+ if (delete_from_server) {
+ snprintf(buf, sizeof buf, "DELE %d\r", msglist[i]);
+ lprintf(CTDL_DEBUG, "<%s\n", buf);
+ if (sock_puts(sock, buf) <0) goto bail;
+ if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
+ lprintf(CTDL_DEBUG, ">%s\n", buf); /* errors here are non-fatal */
+ }