emailing from script

Status
Not open for further replies.

whut

Member
Dec 23, 2022
228
22
18
what are the best and easiest ways to email from a bash or shell script? the email_script.sh will contain variables for email to, email from, subject, body, file to attach etc. If I call fs_cli luarun email.lua, the email is not sent because the domain uuid and domain name are not included. I can hard code those in the lua scripts but seems kind of silly to do so. perhaps /var/www/fusionpbx/app/email_queue/email_test.php could be used from command line?
 

Lim00n

Member
Jan 31, 2020
38
11
8
41
You can include any script in your script and use that to send your email. Are you using lua or bash, youre talking about php aswell? You can include php scripts in php scripts and lua scripts in lua scripts.

If you're using lua you can use resource/functions/send_mail.lua script (include it in your script - require 'resources.functions.send_mail'; and pass the required parameters to it).
 

whut

Member
Dec 23, 2022
228
22
18
As of this moment I have a shell script that is executing a modified copies of email.lua and send.email.lua scripts with hardcoded domain uuid and domain name in the lua scripts. It did not work to send them as parameters. freeswitch errors that the domain uuid is an undefined parameter.

I may setup the the shell script to include these values as variables and modifying the lua to accept these as additional parameters. For a super admin dynamically capturing the domain uuid & name is not my concern. However, for reports being sent to users and admins it would be wise to be dynamically gathering their domain data.

Are there easier ways to access fusion methods of emailing? Daily/weekly/monthly reports, alerts, and the like are what are currently considerations. I think the next level would be to use an attractive branded email template for experience and image consistency should emails to customers be generated.
 
Status
Not open for further replies.