从sails官方在线文档查知
// EmailService.js - in api/services module.exports = { sendInviteEmail: function(options) { var opts = {"type":"messages","call":"send","message": { "subject": "YourIn!", "from_email": "[email protected]", "from_name": "AmazingStartupApp", "to":[ {"email": options.email, "name": options.name} ], "text": "Dear "+options.name+",\nYou‘re in the Beta! Click <insert link> to verify your account" } }; myEmailSendingLibrary.send(opts); } }; //You can then use EmailService anywhere in your app: // Somewhere in a controller EmailService.sendInviteEmail({email: ‘[email protected]‘, name: ‘test‘});
时间: 2024-10-20 23:18:59