From 302b33d48b94d5389edf737c7cc165b637a544d6 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 27 Jan 2024 14:01:57 +0900 Subject: [PATCH] Update sendmail.js --- lib/sendmail.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/sendmail.js b/lib/sendmail.js index b897d42..d167a56 100644 --- a/lib/sendmail.js +++ b/lib/sendmail.js @@ -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;