nodemailer#SentMessageInfo TypeScript Examples

The following examples show how to use nodemailer#SentMessageInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MailPlugin.ts    From skychat with MIT License 6 votes vote down vote up
/**
     * Send an email to an email address
     * @param to
     * @param subject
     * @param content
     */
    public async sendMail(to: string, subject: string, content: string): Promise<SentMessageInfo> {

        if (! this.transporter) {
            throw new Error('Email transport not registered');
        }

        return await this.transporter.sendMail({
            to: to,
            subject: subject,
            text: content
        });
    }
Example #2
Source File: MailPlugin.ts    From skychat with MIT License 6 votes vote down vote up
/**
     * Send an email to a specific user
     * @param user
     * @param subject
     * @param content
     */
    public async sendMailToUser(user: User, subject: string, content: string): Promise<SentMessageInfo> {
        if (! user.email) {
            throw new Error(`This user does not accepts emails`);
        }
        return await this.sendMail(user.email, subject, content);
    }
Example #3
Source File: MailPlugin.ts    From skychat with MIT License 6 votes vote down vote up
/**
     * Send an email to a user using its username
     * @param username
     * @param subject
     * @param content
     */
    public async sendMailToUsername(username: string, subject: string, content: string): Promise<SentMessageInfo> {
        const user = await UserController.getUserByUsername(username);
        if (! user) {
            throw new Error(`User ${username} not found`);
        }
        return await this.sendMailToUser(user, subject, content);
    }