imports/vx/server/daemon/mailman.js
/**
     * Perform the actual send via Mailgun and update the notification
     * in accord with the outcome.
     *
     * @param {object} Notification to send.
     */
Perform the actual send via Mailgun and update the notification
in accord with the outcome.

@param {object} Notification to send.
Perform the actual send via Mailgun and update the notification in accord with the outcome . @param { object } Notification to send .
async sendEmail(notification) {
        const from = Util.i18n("common.label_mail_from")
        const to = Util.getUserEmail(notification.recipientId)
        const subject = notification.subjectKey ?
            Util.i18n(notification.subjectKey, notification.variables) : Util.i18n(notification.key, notification.variables)
        const text = Util.i18n(notification.key, notification.variables)
        OLog.debug(`mailman.js sendEmail notificationId=${notification._id} from=${from} to=${to} subject=[${subject}] text=[${text}]`)
        if (!to) {
            OLog.error(`mailman.js sendEmail notificationId=${notification._id} to is missing, send will not occur`)
            VXApp.updateNotification(notification._id, "EMAIL", [ "processed" ])
            return
        }
        const result = await Service.sendEmail(notification.domain, from, to, subject, null, text);
        if (!result.success) {
            OLog.error(`mailman.js sendEmail *error* notificationId=${notification._id} from=${from} to=${to} ` +
                `subject=[${subject}] error=${result.error}`)
            VXApp.updateNotification(notification._id, "EMAIL", [ "processed" ])
            return
        }
        VXApp.updateNotification(notification._id, "EMAIL", [ "processed", "sent" ])
    }
async sendEmail ( notification ) { const from = Util . i18n ( "common.label_mail_from" ) const to = Util . getUserEmail ( notification . recipientId ) const subject = notification . subjectKey ? Util . i18n ( notification . subjectKey , notification . variables ) : Util . i18n ( notification . key , notification . variables ) const text = Util . i18n ( notification . key , notification . variables ) OLog . debug ( ` ${ notification . _id } ${ from } ${ to } ${ subject } ${ text } ` ) if ( ! to ) { OLog . error ( ` ${ notification . _id } ` ) VXApp . updateNotification ( notification . _id , "EMAIL" , [ "processed" ] ) return } const result = await Service . sendEmail ( notification . domain , from , to , subject , null , text ) ; if ( ! result . success ) { OLog . error ( ` ${ notification . _id } ${ from } ${ to } ` + ` ${ subject } ${ result . error } ` ) VXApp . updateNotification ( notification . _id , "EMAIL" , [ "processed" ] ) return } VXApp . updateNotification ( notification . _id , "EMAIL" , [ "processed" , "sent" ] ) }
Perform the actual send via Mailgun and update the notification
 in accord with the outcome.
Perform the actual send via Mailgun and update the notification in accord with the outcome .