fipamo/public/assets/scripts/dash/app/actions/Mailer.js
ro b37e64d062
Updated Mailer (#113)
Removed email settings from settings.json and moved them to the .env
file to use Laravel's mailer functionality.

references to the old mailer has been removed from settings.json,
data sorting class and the settings template file

the front end script has also been updated to accomodate different
message types, starting with a test message so members can make sure the
settings defined in the .env are working
2024-06-05 13:33:11 -06:00

37 lines
835 B
JavaScript

import FipamoAdminAPI from '../../libraries/FipamoAdminAPI.js';
import Notficaton from '../ui/Notifications.js';
const notify = new Notficaton();
export default class Mailer {
//--------------------------
// constructor
//--------------------------
constructor() {}
//--------------------------
// methods
//--------------------------
sendMail(task = null, content = null) {
let text = '';
if (task == 'TEST') {
text = 'This is a test email';
} else {
text = content;
}
let mailData = {
content: text,
mail_task: task
};
let admin = new FipamoAdminAPI();
admin
.sendMail(mailData)
.then(result => {
notify.alert(result.message, true);
})
.catch(err => {
notify.alert(err.message, false);
});
}
//--------------------------
// event handlers
//--------------------------
}