Use Haraka only for outbound #3438
|
Is there a way to use Haraka only to outbound emails? Something like I leave a eml on a particular folder and Haraka pick it up, validate, and sends it out. |
Replies: 1 comment
|
There's no built-in "pickup folder" like IIS/Exchange have, but Haraka is perfectly fine as an outbound-only relay. Pretty much anything that gets marked as relaying goes into the outbound queue and Haraka delivers it via MX. Two ways to feed it: 1. Submit over SMTP from a small script (easiest). Turn on the The ACL check is on by default in the relay plugin. Then whatever drops the .eml files can just send them to Haraka, e.g. with nodemailer: const nodemailer = require("nodemailer");
const fs = require("node:fs");
const transport = nodemailer.createTransport({ host: "127.0.0.1", port: 25 });
await transport.sendMail({
envelope: { from: "noreply@example.com", to: ["user@example.org"] },
raw: fs.readFileSync("/path/to/outbox/msg.eml"),
});If it's not on the same box, use port 587 with the 2. Do it inside Haraka with a plugin. Write a plugin that watches the folder and hands each file to the outbound queue: const outbound = require("./outbound");
outbound.send_email(from, to, contents, (code, msg) => {
if (code === DENY) plugin.logerror(`queue failed: ${msg}`);
});The callback fires when it's queued, not delivered, so hook Personally I'd go with 1, since you get the normal SMTP path (DKIM signing via |
There's no built-in "pickup folder" like IIS/Exchange have, but Haraka is perfectly fine as an outbound-only relay. Pretty much anything that gets marked as relaying goes into the outbound queue and Haraka delivers it via MX. Two ways to feed it:
1. Submit over SMTP from a small script (easiest). Turn on the
relayplugin (addrelaytoconfig/plugins) and allow localhost inconfig/relay_acl_allow:The ACL check is on by default in the relay plugin. Then whatever drops the .eml files can just send them to Haraka, e.g. with nodemailer: