mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 07:21:43 +00:00
Update sendmail.js
This commit is contained in:
parent
9cdfd205bf
commit
302b33d48b
|
@ -6,21 +6,18 @@
|
|||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var LIB = require("lib/std");
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Private APIs / Utility functions
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.VERSIONINFO = "Sendmail Lib (sendmail.js) version 0.1";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
var usePersitsMailSender = false;
|
||||
var useSSL = false;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Send Mail Message
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.sendmail = function(msg) {
|
||||
function sendmail(msg) {
|
||||
var ok, MAIL;
|
||||
|
||||
console.log("SENDMAIL: " + msg.To);
|
||||
|
@ -61,16 +58,16 @@ exports.sendmail = function(msg) {
|
|||
} else {
|
||||
|
||||
// Use CDO objects to send mail. Setup SMTP server details.
|
||||
var CONF = LIB.CreateObject("CDO.Configuration");
|
||||
var CONF = CreateObject("CDO.Configuration");
|
||||
CONF.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
|
||||
CONF.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = msg.MAILHOST;
|
||||
CONF.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = msg.MAILPORT || 25;
|
||||
CONF.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0;
|
||||
CONF.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 0;
|
||||
CONF.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = (!useSSL ? 0 : 1);
|
||||
CONF.Fields.Update();
|
||||
|
||||
// Create the email message
|
||||
MAIL = LIB.CreateObject("CDO.Message");
|
||||
MAIL = CreateObject("CDO.Message");
|
||||
MAIL.Configuration = CONF;
|
||||
CONF = null;
|
||||
if (msg.Name) {
|
||||
|
@ -105,6 +102,8 @@ exports.sendmail = function(msg) {
|
|||
return ok;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
exports.sendmail = sendmail;
|
||||
|
||||
return scope;
|
||||
exports.VERSIONINFO = "Sendmail Library (sendmail.js) version 0.1.1";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user