Skip to content

Instantly share code, notes, and snippets.

@paschmann
Created February 12, 2018 21:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paschmann/144fea92015428bd773adfee290ca637 to your computer and use it in GitHub Desktop.
Save paschmann/144fea92015428bd773adfee290ca637 to your computer and use it in GitHub Desktop.
//XSJS File
function sendUserEmail() {
try {
var from = "test@test.com";
var to = $.request.parameters.get("email");
var subject = $.request.parameters.get("subject");
var message = $.request.parameters.get("message");
var mail = new $.net.Mail({
sender: {address: from},
to: [{ address: to}],
subject: "Subject : "+subject+" ",
subjectEncoding:"UTF-8",
parts: [ new $.net.Mail.Part({
type: $.net.Mail.Part.TYPE_TEXT,
contentType: "text/plain",
text: message,
encoding:"UTF-8"
})]
});
var returnValue = mail.send();
var response = "MessageId = " + returnValue.messageId + ", final reply = " + returnValue.finalReply;
$.response.setBody(JSON.stringify(response));
}
catch (e) {
Dataset.response = e.message + " ";
}
}
//XSHTTPDEST File
description = "SMTP Email Account";
host = "localhost";
port = 25;
proxyType = http;
proxyHost = "proxy";
proxyPort = 8080;
authType = basic;
useSSL = true;
timeout = 0;
sslHostCheck = true;
sslAuth = anonymous;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment