parent
e26b7d4923
commit
83765136cc
|
@ -25,4 +25,36 @@ export class Mailer {
|
|||
throw new MailSendingError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for sending a runner selfservice welcome mail.
|
||||
* @param to_address The address the mail will be sent to. Should always get pulled from a runner object.
|
||||
* @param token The requested selfservice token - will be combined with the app_url to generate a selfservice profile link.
|
||||
*/
|
||||
public static async sendSelfserviceWelcomeMail(to_address: string, token: string, locale: string = "en") {
|
||||
try {
|
||||
await axios.post(`${Mailer.base}/registration?locale=${locale}&key=${Mailer.key}`, {
|
||||
address: to_address,
|
||||
selfserviceToken: token
|
||||
});
|
||||
} catch (error) {
|
||||
throw new MailSendingError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for sending a runner selfservice link forgotten mail.
|
||||
* @param to_address The address the mail will be sent to. Should always get pulled from a runner object.
|
||||
* @param token The requested selfservice token - will be combined with the app_url to generate a selfservice profile link.
|
||||
*/
|
||||
public static async sendSelfserviceForgottenMail(to_address: string, token: string, locale: string = "en") {
|
||||
try {
|
||||
await axios.post(`${Mailer.base}/registration_forgot?locale=${locale}&key=${Mailer.key}`, {
|
||||
address: to_address,
|
||||
selfserviceToken: token
|
||||
});
|
||||
} catch (error) {
|
||||
throw new MailSendingError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue