diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 87c339a8bffe59ccf750dff122d00659a1459426..f0eef844cac66fe9cb1bcb0ba4aedc8e3c04ef7b 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3402,7 +3402,11 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
 					}
 					/* Notification and disposal needs to happen after the copy, though. */
 					if (ast_fileexists(fn, NULL, NULL)) {
+#ifdef IMAP_STORAGE
 						notify_new_message(chan, vmu, vms, msgnum, duration, fmt, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL));
+#else
+						notify_new_message(chan, vmu, NULL, msgnum, duration, fmt, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL));
+#endif
 						DISPOSE(dir, msgnum);
 					}
 				}