Skip to content

Instantly share code, notes, and snippets.

@rahul-desai3
Created July 8, 2015 13:51
Show Gist options
  • Save rahul-desai3/238422d2e4426e1e580a to your computer and use it in GitHub Desktop.
Save rahul-desai3/238422d2e4426e1e580a to your computer and use it in GitHub Desktop.
Unable to send emails using Haraka
var outbound = require('./outbound');
var plugin = this;
var to = '[email protected]';
var from = '[email protected]';
var contents = [
"From: [email protected]",
"To: [email protected]",
"MIME-Version: 1.0",
"Content-type: text/plain; charset=us-ascii",
"Subject: Some subject here",
"",
"Some email body here",
""].join("\n");
var outnext = function (code, msg) {
switch (code) {
case DENY: plugin.logerror("Sending mail failed: " + msg);
break;
case OK: plugin.loginfo("mail sent");
next();
break;
default: plugin.logerror("Unrecognised return code from sending email: " + msg);
next();
}
};
outbound.send_email(from, to, contents, outnext);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment