import nodemailer from 'nodemailer';
import { defaults as emailDefaults } from './defaults.js';
const mockEmailHandler = async (emailConfig)=>{
    const testAccount = await nodemailer.createTestAccount();
    const smtpOptions = {
        ...emailConfig,
        auth: {
            pass: testAccount.pass,
            user: testAccount.user
        },
        fromAddress: emailConfig?.fromAddress || emailDefaults.fromAddress,
        fromName: emailConfig?.fromName || emailDefaults.fromName,
        host: 'smtp.ethereal.email',
        port: 587,
        secure: false
    };
    return {
        account: testAccount,
        transport: nodemailer.createTransport(smtpOptions)
    };
};
export default mockEmailHandler;

//# sourceMappingURL=mockHandler.js.map