SARK V4.0.0 vmail
- 1 Introduction
- 2 SARK email client implementations
- 3 Common ssmtp setups
- 4 SARK500 restrictions
Voicemail to email uses two different mechanisms depending upon the distro; SME Server, Debian (SARK200) or PIKA Warp (SARK500). There are also some restrictions for the SARK500 embedded PBX.
Setting the sender in Asterisk
Asterisk's voicemail to email implementation is pretty robust and there are no known problems with it. However, you may encounter delivery problems with your own email server. This will usually be due to your server not recognising the incoming mail and treating it as spam. As a result, it may end up in your spam folder or it may not be relayed to its final destination. Asterisk allows you to modify the FROM address on your emails in order to make the mail more acceptable to your mail server. To do this you can modify the asterisk file sark_vmail_header.conf, which you will find in asterisk->edit
The two lines which influence where the email appears to come from are:-
This setting can be used to identify the source of a voicemail notification message. The value is a string which can be encoded one of two ways. If the string is of the form email@example.com, then the string will be used as the source address for all voicemail notification emails. If the string is of the form someone, then the host name of the machine running Asterisk will be postpended to the string after insertion of the '@' symbol.
This setting allows the adminstrator to override a portion of the From: line in the voicemail notification message. By default, Asterisk sends the string "From: Asterisk PBX <who>. The "Asterisk PBX" portion of the From: line can be overridden by specifying your own string as the value for this setting. One might use this to customize the voicemail notification message and/or remove the reference to "Asterisk PBX".
SARK email client implementations
SME Server (SARK850, SARK1000, SARK1200)
The SME server distro uses qmail and it has a full-blown email server on-board. In general, it will just work with most implementations although you may have to set serveremail and fromstring (see above) for your set-up.
SARK200 & SARK500
The embedded implementations have no mailserver on-board, instead they have a lightweight mail client called ssmtp. ssmtp is pretty easy to set up in most cases, however, it isn't as all-encompassing or as "smart" as qmail on SME server so you have to do a little more work. The comments above about sending address also hold true for ssmtp. On debian sark releases 4.0.0-80 and higher, you set up your email preferences using the SMTP tab of the Network menu. Shown here is an example using Gmail; the setup for SME Server is identical, except that you should set the smtphost to point to your SME Server mailserver
This is the url of your mail server; in the example we are using gmail
This is the user name of the email account you wish to relay through
This is the password of the account
Specifies whether your email server requires an SSL/TLS connection
Tells ssmtp whether to send STARTTLS or not (some mailservers, such as gmail and the qmail setup on SME Server require this)
Common ssmtp setups
If you have your own internal mailserver and you only wish to send emails to users on that server from inside the same network then you will often only need to specify the local url of the mailserver and nothing else. i.e. set user and password to blank and set tls/starttls to NO. You may need to check with your mail administrator that the server accepts local mail over port 25 (SMTP).
forwarding mail through a server
If you have users on other servers and you wish to forward mail to them you will need an account on your own mailserver through which to forward the mail. Usually you will as a minimum need to specify a username and a password for an account on that server. Your mailserver administrator should be able to help you and also tell you whether to use SSL/TLS (you can use these terms pretty much interchangeably when talking about mail servers) and whether STARTTLS is required and which secure port to communicate on.
forwarding through a gmail account
Often, the easiest and fastest way to set up a mail forward is to create a gmail account to do it for you. Create a gmail account, perhaps with a descriptive name e.g. firstname.lastname@example.org. Set up your SMTP page as we've done it in the screenshot above and it should just work for you. If your end users are using Google mail then there is a very good chance that google will dismiss the mail as spam and you'll find it in the spam folder. Your user(s) can fix this by simply adding the sender to their gmail contacts lists.
testing your SMTP set up
You can test your mail account and forwarding by manually sending test mail from the SARK200 or SARK500 console using the sendmail command. sendmail can be quite complex to use from the CLI but here is a simple way to use it to test your mail. At the console do
this will give you a blank line. Type the following like this
To:email@example.com From:firstname.lastname@example.org Subject: A test email to you This is a test email CTRL+D
The only tricky bit is that you need to skip a couple of blank lines after the Subject line and at the end of the body of your mail. As mentioned above, if you are using Google mail then there is a very good chance that google will dismiss the mail as spam and you'll find it in the spam folder. You can fix this by simply adding the sender to your gmail contacts list. Once you have proved this step then your vmail to email should work without further attention. If you get into trouble simply type Ctrl+D at any point to exit the command.
A word on mail passwords
SSMTP does not like passwords that end in a # and they may be sent incorrectly to the mailserver. As a general rule you should avoid using special characters as the last character in the mail account password you use for your Asterisk mail forwarding account.
The SARK500 is not able to use SSL/TLS to send emails so your server must support SMTP (port 25) unencrypted mail. As long as it does then the S500 will work fine. Simply set up your mail with TLS and STARTTLS set to NO. Your email server administrator should be able to advise you on this. In the worst case, where your server will NOT accept mail over port 25 then you can again use gmail, with some restrictions. Gmail will accept mail over port 25 but it will only forward it to other gmail users. It will not forward outside of gmail. The gmail url for port 25 is
The S500 SMTP implementation is a little different to the SARK200, it simply gives you a box into which you can type the relevant settings for ssmtp. There is an example below. Set up for gmail is trivial; you don't even need a dedicated gmail account for it to work.
This will allow you to send mail to any gmail user. You can of course create a rule within that user to forward the mail on to a designated external user. It's a bit more work to set up but it should work fine.