+ addUserBlockJob (user: MUser, blocked: boolean, reason?: string) {
+ const reasonString = reason ? ` for the following reason: ${reason}` : ''
+ const blockedWord = blocked ? 'blocked' : 'unblocked'
+
+ const to = user.email
+ const emailPayload: EmailPayload = {
+ to: [ to ],
+ subject: 'Account ' + blockedWord,
+ text: `Your account ${user.username} on ${CONFIG.INSTANCE.NAME} has been ${blockedWord}${reasonString}.`
+ }
+
+ return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
+ }
+
+ addContactFormJob (fromEmail: string, fromName: string, subject: string, body: string) {
+ const emailPayload: EmailPayload = {
+ template: 'contact-form',
+ to: [ CONFIG.ADMIN.EMAIL ],
+ replyTo: `"${fromName}" <${fromEmail}>`,
+ subject: `(contact form) ${subject}`,
+ locals: {
+ fromName,
+ fromEmail,
+ body,
+
+ // There are not notification preferences for the contact form
+ hideNotificationPreferences: true
+ }
+ }
+
+ return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
+ }
+
+ async sendMail (options: EmailPayload) {
+ if (!isEmailEnabled()) {