Mail not sended from dialplan

i use a hook in dialplan to send email in non-answer case:

[[email protected] asterisk]# cat extensions_override_freepbx.conf
[sub-missedcallnotify]
exten => s,1,ExecIf($["${DB(AMPUSER/${ORIGEXTTOCALL}/missedcallnotify/status)}"=="enabled" & ["${DIALSTATUS}" == "CANCEL" | "${DIALSTATUS}" == "BUSY" | "${DIALSTATUS}" == "NOANSWER"] & "${OUTBOUND_GROUP}" == "" & "${DIAL_TRUNK}" == "" & "${RingGroupMethod}" == "none"]?System(echo "" , mail -s "MissedCall (${ORIGEXTTOCALL}) - ${CALLERID(name)} <${CALLERID(num)}>" [email protected] < /dev/null))
exten => s,n,ExecIf($["${DB_EXISTS(AMPGROUP/${NODEST}/email)}"=="1" & "${DIALSTATUS}" == "CANCEL" & "${OUTBOUND_GROUP}" == "" & "${DIAL_TRUNK}" == "" & "${RingGroupMethod}" != "none"]?System(echo "" , mail -s "MissedCallGroup (${NODEST}) - ${CALLERID(name)} <${CALLERID(num)}>" [email protected] < /dev/null))

;exten => s,1,ExecIf($["${DB(AMPUSER/${ORIGEXTTOCALL}/missedcallnotify/status)}"=="enabled" & ["${DIALSTATUS}" == "CANCEL" | "${DIALSTATUS}" == "BUSY" | "${DIALSTATUS}" == "NOANSWER"] & "${OUTBOUND_GROUP}" == "" & "${DIAL_TRUNK}" == "" & "${RingGroupMethod}" == "none"]?System(echo "" , mail -s "MissedCall (${ORIGEXTTOCALL}) - ${CALLERID(name)} <${CALLERID(num)}>" ${DB(AMPUSER/${ORIGEXTTOCALL}/missedcallnotify/email)} < /dev/null))
;exten => s,n,ExecIf($["${DB_EXISTS(AMPGROUP/${NODEST}/email)}"=="1" & "${DIALSTATUS}" == "CANCEL" & "${OUTBOUND_GROUP}" == "" & "${DIAL_TRUNK}" == "" & "${RingGroupMethod}" != "none"]?System(echo "" , mail -s "MissedCallGroup (${NODEST}) - ${CALLERID(name)} <${CALLERID(num)}>" ${DB(AMPGROUP/${NODEST}/email)} < /dev/null))

;--== end of [sub-missedcallnotify] ==--;

got a log, then call was missed:

-- Executing [[email protected]:1] ExecIf("IAX2/201-864", "0?System(echo "" , mail -s "MissedCall (novm) - 201 <201>" [email protected] < /dev/null)") in new stack
-- Executing [[email protected]:2] ExecIf("IAX2/201-864", "0?System(echo "" , mail -s "MissedCallGroup () - 201 <201>" [email protected] < /dev/null)") in new stack

but email does not send.
What is wrong?

And what shows the Messages or the maillog log files?

The zero says that your “IF” condition is false. There’s something wrong with your s,1, and s,n steps.

I’d start with looking through the Asterisk Database and make sure the AMPUSER/IAX2/201-864/missedcallnotify/status is set to “enabled”. The log says it isn’t…