add sendSingleMail
This commit is contained in:
@@ -46,6 +46,24 @@ class MailService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手動發送郵件方法 (供 API 呼叫)
|
||||||
|
*/
|
||||||
|
async sendSingleMail(mailto, mailtitle, mailtext) {
|
||||||
|
try {
|
||||||
|
await this.transporter.sendMail({
|
||||||
|
from: 'kylinsys@gmail.com',
|
||||||
|
to: mailto,
|
||||||
|
subject: mailtitle,
|
||||||
|
text: mailtext
|
||||||
|
});
|
||||||
|
return { success: true };
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(`單筆郵件發送失敗: ${error.message}`);
|
||||||
|
return { success: false, error: error.message };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = new MailService();
|
module.exports = new MailService();
|
||||||
Reference in New Issue
Block a user