mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-07 12:16:04 +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
|
// Private APIs / Utility functions
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
exports.VERSIONINFO = "Sendmail Lib (sendmail.js) version 0.1";
|
var usePersitsMailSender = false;
|
||||||
exports.global = global;
|
var useSSL = false;
|
||||||
exports.require = global.require;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
// Send Mail Message
|
// Send Mail Message
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
exports.sendmail = function(msg) {
|
function sendmail(msg) {
|
||||||
var ok, MAIL;
|
var ok, MAIL;
|
||||||
|
|
||||||
console.log("SENDMAIL: " + msg.To);
|
console.log("SENDMAIL: " + msg.To);
|
||||||
|
@ -61,16 +58,16 @@ exports.sendmail = function(msg) {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Use CDO objects to send mail. Setup SMTP server details.
|
// 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/sendusing") = 2;
|
||||||
CONF.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = msg.MAILHOST;
|
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/smtpserverport") = msg.MAILPORT || 25;
|
||||||
CONF.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0;
|
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();
|
CONF.Fields.Update();
|
||||||
|
|
||||||
// Create the email message
|
// Create the email message
|
||||||
MAIL = LIB.CreateObject("CDO.Message");
|
MAIL = CreateObject("CDO.Message");
|
||||||
MAIL.Configuration = CONF;
|
MAIL.Configuration = CONF;
|
||||||
CONF = null;
|
CONF = null;
|
||||||
if (msg.Name) {
|
if (msg.Name) {
|
||||||
|
@ -105,6 +102,8 @@ exports.sendmail = function(msg) {
|
||||||
return ok;
|
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