2024-07-17 23:08:10 +02:00
|
|
|
import ContentRequest from '../../libraries/ContentRequest.js';
|
2024-03-19 22:34:01 +01:00
|
|
|
import Notficaton from '../ui/Notifications.js';
|
2024-03-06 18:53:40 +01:00
|
|
|
const notify = new Notficaton();
|
|
|
|
export default class Mailer {
|
2024-03-19 22:34:01 +01:00
|
|
|
//--------------------------
|
|
|
|
// constructor
|
|
|
|
//--------------------------
|
|
|
|
constructor() {}
|
|
|
|
//--------------------------
|
|
|
|
// methods
|
|
|
|
//--------------------------
|
2024-06-05 21:33:11 +02:00
|
|
|
sendMail(task = null, content = null) {
|
|
|
|
let text = '';
|
|
|
|
if (task == 'TEST') {
|
|
|
|
text = 'This is a test email';
|
|
|
|
} else {
|
|
|
|
text = content;
|
|
|
|
}
|
2024-03-19 22:34:01 +01:00
|
|
|
let mailData = {
|
2024-06-05 21:33:11 +02:00
|
|
|
content: text,
|
|
|
|
mail_task: task
|
2024-03-19 22:34:01 +01:00
|
|
|
};
|
2024-07-17 23:08:10 +02:00
|
|
|
let admin = new ContentRequest();
|
2024-03-19 22:34:01 +01:00
|
|
|
admin
|
|
|
|
.sendMail(mailData)
|
|
|
|
.then(result => {
|
|
|
|
notify.alert(result.message, true);
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
notify.alert(err.message, false);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//--------------------------
|
|
|
|
// event handlers
|
|
|
|
//--------------------------
|
2024-03-06 18:53:40 +01:00
|
|
|
}
|