Voicemail with Email Notification

Features Asterisk 18+ -- Last reviewed 2026-06-28 voicemail email notifications Found this useful? Upvote it. ×

Voicemail with Email Notification

Set up voicemail boxes that send an email with the voice message attached whenever a new message is left.

Requirements

Voicemail Configuration (voicemail.conf)

[general]
format = wav49|wav
serveremail = asterisk@example.com
attach = yes
skipms = 3000
maxsilence = 10
silencethreshold = 128
maxlogins = 3
emaildateformat = %A, %B %d, %Y at %r
emailsubject = New voicemail from ${VM_CALLERID}
emailbody = Hi ${VM_NAME},\n\nYou have a new ${VM_DUR} long voicemail from ${VM_CALLERID} in mailbox ${VM_MAILBOX}.\n\n--Asterisk

[default]
; mailbox => password,name,email,pager,options
100 => 1234,John Smith,john@example.com,,tz=eastern|attach=yes
101 => 5678,Jane Doe,jane@example.com,,tz=eastern|attach=yes|delete=yes

Dialplan

[voicemail-main]
; Direct to voicemail (unavailable greeting)
exten => s,1,NoOp(Sending caller to voicemail)
 same => n,VoiceMail(100@default,u)
 same => n,Hangup()

; Busy greeting variant
exten => busy,1,VoiceMail(100@default,b)
 same => n,Hangup()

[voicemail-check]
; Let users check their voicemail
exten => *98,1,Answer()
 same => n,VoiceMailMain(@default)
 same => n,Hangup()

; Check a specific mailbox
exten => *99,1,Answer()
 same => n,VoiceMailMain(${CALLERID(num)}@default)
 same => n,Hangup()

How it works

  1. VoiceMail(mailbox@context,options): Records a voicemail. The u flag plays the "unavailable" greeting; b plays the "busy" greeting.
  2. Email delivery: When attach=yes, Asterisk calls the system mailer to send an email with the audio file attached. The emailsubject and emailbody templates use Asterisk voicemail variables.
  3. VoiceMailMain(): The voicemail retrieval application. Without arguments, it prompts for a mailbox number. With a mailbox argument, it goes directly to that box.
  4. delete=yes: When set per-mailbox, the voicemail is deleted from the server after being emailed. Useful when users only check voicemail via email.

Tips

User Notes

Know a tip or gotcha for this topic? Share it below and help others.

Contribute a note

Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.

Moderated before publishing. Email never shown.
Related Snippets