That works, but with the type of call flow you are using, it can be easier. Create a context like:
[send-email]
exten => s,1,NoOp(Entering user defined context [send-email] in extensions_custom.conf)
exten => s,n,System(echo 'Call from ${CALLERID(name)} at ${CALLERID(number)}' | mail -s 'SUBJECT' '[email protected]')
exten => s,n,Return()
The final line changes to a return. Then create a Custom Destination that references the above as
send-email,s,1
And be sure to enable the return option and choose the IVR as the destination. You then edit the inbound route to go to the Custom Destination.