Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 90000) +++ apps/app_voicemail.c (working copy) @@ -3320,7 +3320,17 @@ * ODBC storage does the entire copy with SQL. */ if (ast_fileexists(fn, NULL, NULL) > 0) { +#ifdef IMAP_STORAGE + /* Don't save to IMAP if delete flag is set to YES */ + if (!ast_test_flag(vmu, VM_DELETE)) { + STORE(dir, vmu->mailbox, vmu->context, msgnum, chan, vmu, fmt, duration, vms); + } else { + /* Fix message count when delete=yes (to externnotify) */ + vms->newmessages--; + } +#else STORE(dir, vmu->mailbox, vmu->context, msgnum, chan, vmu, fmt, duration, vms); +#endif } /* Are there to be more recipients of this message? */