[Solved] asterisk does not respect "email from" settings

Trying to setup voicemail to email for asterisk.

Edited /etc/postfix/main.cf

myorigin = myvaliddomain.com

smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

In the /etc/postfix/sasl_passwd file -
mail.myvaliddomain.com login:password

Then hashed the password and reloaded the postfix

postmap sasl_passwd

postfix reload

Also change /etc/asterisk/vm_general.inc
[email protected]

Setup the extension to send email upon receiving the voicemail email, but email is failed to be sent.

Checking log shows:
from=[[email protected]], size=840, nrcpt=1 (queue active)
to=[[email protected]], relay=myvaliddomain.com[XX.XXX.XX.X]:2626, delay=2.8, delays=0.38/0.04/2.2/0.21, dsn=5.0.0, status=bounced (host myvaliddomain.com[XX.XXX.XX.X] said: 550-Verification failed for [[email protected]] 550-No Such User Here 550 Sender verify failed (in reply to RCPT TO command))

Question is why asterisk is trying to send using from=[[email protected]]? My ISP validates the user and rejects the email. I expected from=[[email protected]] as specified in /etc/asterisk/vm_general.inc or there is another place for it?
Thanks for the assistance.

Thanks mate.
Used the link provided for the postfix masquerade and now it works as supposed to.

I don’t know anything about Postfix but have seen the same thing with Sendmail.

It has to do with the user (Unix user) who is sending the mail. In your case it is user “asterisk”.

Postfix is probably not allowing user “asterisk” to change its From address. There’s some sort of user enforcement going on, and I would bet you can find a setting for that in your postfix config.

Just googled around a little and think this might help: http://www.cyberciti.biz/tips/howto-postfix-masquerade-change-email-mail-address.html

If you don’t plan to do a lot of mail processing on your asterisk server (you ought not to), I recommend msmtp as a simple way to get outbound mail off your system: http://msmtp.sourceforge.net/