GithubHelp home page GithubHelp logo

vithalreddy / node-mailin Goto Github PK

View Code? Open in Web Editor NEW
76.0 6.0 19.0 440 KB

Artisanal inbound emails for every web app using nodejs

Home Page: https://stackfame.com/receive-inbound-emails-node-js

License: MIT License

JavaScript 100.00%
smtp-server smtp nodejs spf dkim email mailn node-mailer

node-mailin's Introduction

Node-Mailin

Artisanal inbound emails for every web app

Node-Mailin is an smtp server that listens for emails, parses as json. It checks the incoming emails dkim, spf, spam score (using spamassassin) and tells you in which language the email is written.

Node-Mailin can be used as a standalone application directly from the command line, or embedded inside a node application.

Initial setup

Dependencies

Node-Mailin can run without any dependencies other than node itself, but having them allow you to use some additional features.

So first make sure the node is available, and the node command as well. On Debian/Ubuntu boxes:

sudo aptitude install nodejs ; sudo ln -s $(which nodejs) /usr/bin/node

To handle the spam score computation, Node-Mailin depends on spamassassin and its server interface spamc. Both should be available as packages on your machine. For instance on Debian/Ubuntu boxes:

Spamassassin is not enabled by default, enable it in with update-rc.d spamassassin enable command.

sudo aptitude install spamassassin spamc
sudo update-rc.d spamassassin enable
sudo service spamassassin start

Node versions

Current LTS and LTS+ versions.

The crux: setting up your DNS correctly

In order to receive emails, your smtp server address should be made available somewhere. Two records should be added to your DNS records. Let us pretend that we want to receive emails at *@subdomain.domain.com:

  • First an MX record: subdomain.domain.com MX 10 mxsubdomain.domain.com. This means that the mail server for addresses like *@subdomain.domain.com will be mxsubdomain.domain.com.
  • Then an A record: mxsubdomain.domain.com A the.ip.address.of.your.Node-Mailin.server. This tells at which ip address the mail server can be found.

You can fire up Node-Mailin (see next section) and use an smtp server tester to verify that everything is correct.

Using Node-Mailin

From the command line

Install Node-Mailin globally.

sudo npm install -g node-mailin

Run it, (addtionnal help can be found using node-mailin --help). By default, Node-Mailin will listen on port 25, the standard smtp port. you can change this port for testing purpose using the --port option. However, do not change this port if you want to receive emails from the real world.

Ports number under 1000 are reserved to root user. So two options here. Either run Node-Mailin as root:

sudo node-mailin --port 25

Or, prefered choice, use something like authbind to run Node-Mailin with a standard user while still using port 25. Here comes a tutorial on how to setup authbind. In this case, do something like:

authbind --deep node-mailin --port 25

and make sure that your user can write to the log file.

At this point, Node-Mailin will listen for incoming emails, parse them, Then you can store them wherever you want.

Gotchas
  • error: listen EACCES: your user do not have sufficients privileges to run on the given port. Ports under 1000 are restricted to root user. Try with sudo.
  • error: listen EADDRINUSE: the current port is already used by something. Most likely, you are trying to use port 25 and your machine's mail transport agent is already running. Stop it with something like sudo service exim4 stop or sudo service postfix stop before using Node-Mailin.
  • error: Unable to compute spam score ECONNREFUSED: it is likely that spamassassin is not enabled on your machine, check the /etc/default/spamassassin file.
  • node: command not found: most likely, your system does not have node installed or it is installed with a different name. For instance on Debian/Ubuntu, the node interpreter is called nodejs. The quick fix is making a symlink: ln -s $(which nodejs) /usr/bin/node to make the node command available.
  • Uncaught SenderError: Mail from command failed - 450 4.1.8 <[email protected]>: Sender address rejected: Domain not found: The smtpOption disableDNSValidation is set to false and an email was sent from an invalid domain.

Embedded inside a node application

Install node-mailin locally.

sudo npm install --save node-mailin

Start the node-mailin server and listen to events.

const nodeMailin = require("node-mailin");

/* Start the Node-Mailin server. The available options are:
 *  options = {
 *     port: 25,
 *     logFile: '/some/local/path',
 *     logLevel: 'warn', // One of silly, info, debug, warn, error
 *     smtpOptions: { // Set of options directly passed to simplesmtp.createServer(smtpOptions)
 *        SMTPBanner: 'Hi from a custom Node-Mailin instance',
 *        // By default, the DNS validation of the sender and recipient domains is disabled so.
 *        // You can enable it as follows:
 *        disableDNSValidation: false
 *     }
 *  };
 * parsed message. */
nodeMailin.start({
  port: 25
});

/* Access simplesmtp server instance. */
nodeMailin.on("authorizeUser", function(connection, username, password, done) {
  if (username == "johnsmith" && password == "mysecret") {
    done(null, true);
  } else {
    done(new Error("Unauthorized!"), false);
  }
});

/* Event emitted when the "From" address is received by the smtp server. */
nodeMailin.on('validateSender', async function(session, address, callback) {
    if (address == '[email protected]') { /*blacklist a specific email adress*/
        err = new Error('You are blocked'); /*Will be the SMTP server response*/
        err.responseCode = 530; /*Will be the SMTP server return code sent back to sender*/
        callback(err);
    } else {
        callback()
    }
});

/* Event emitted when the "To" address is received by the smtp server. */
nodeMailin.on('validateRecipient', async function(session, address, callback) {
    console.log(address) 
    /* Here you can validate the address and return an error 
     * if you want to reject it e.g: 
     *     err = new Error('Email address not found on server');
     *     err.responseCode = 550;
     *     callback(err);*/
    callback()
});

/* Event emitted when a connection with the Node-Mailin smtp server is initiated. */
nodeMailin.on("startMessage", function(connection) {
  /* connection = {
      from: '[email protected]',
      to: '[email protected]',
      id: 't84h5ugf',
      authentication: { username: null, authenticated: false, status: 'NORMAL' }
    }
  }; */
  console.log(connection);
});

/* Event emitted after a message was received and parsed. */
nodeMailin.on("message", function(connection, data, content) {
  console.log(data);
  /* Do something useful with the parsed message here.
   * Use parsed message `data` directly or use raw message `content`. */
});

nodeMailin.on("error", function(error) {
  console.log(error);
});
Rejecting an incoming email

You can reject an incoming email when the validateRecipient or validateSender event gets called and you run the callback with an error (Can be anything you want, preferably an actual SMTP server return code)

nodeMailin.on('validateSender', async function(session, address, callback) {
    if (address == '[email protected]') {         /*blacklist a specific email adress*/
        err = new Error('Email address was blacklisted'); /*Will be the SMTP server response*/
        err.responseCode = 530;             /*Will be the SMTP server return code sent back to sender*/
        callback(err);                      /*Run callback with error to reject the email*/
    } else {
        callback()                          /*Run callback to go to next step*/
    }
});
Events
  • startData (connection) - DATA stream is opened by the client.
  • data (connection, chunk) - E-mail data chunk is passed from the client.
  • dataReady (connection, callback) - Client has finished passing e-mail data. callback returns the queue id to the client.
  • authorizeUser (connection, username, password, callback) - Emitted if requireAuthentication option is set to true. callback has two parameters (err, success) where success is a Boolean and should be true, if user is authenticated successfully.
  • validateSender (connection, email, callback) - Emitted if validateSender listener is set up.
  • senderValidationFailed (connection, email, callback) - Emitted if a sender DNS validation failed.
  • validateRecipient (connection, email, callback) - Emitted if validateRecipients listener is set up.
  • recipientValidationFailed (connection, email, callback) - Emitted if a recipient DNS validation failed.
  • close (connection) - Emitted when the connection to a client is closed.
  • startMessage (connection) - Connection with the Node-Mailin smtp server is initiated.
  • message (connection, data, content) - Message was received and parsed.
  • error (error) - And Error Occured.

Todo

webhooks.

Docs: StackFame Tech Blog

Credits

  • Postman image copyright Charlie Allen.
  • Heavily Inspired by mailin NPM Module.

node-mailin's People

Contributors

betahuhn avatar dependabot[bot] avatar sachinbhutani avatar vithalreddy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

node-mailin's Issues

SPF is not actually checked against

Trying to find a good enough spf library. When reading your code for clues, I noticed that the code for validateSpf only checks if the domain's spf records are valid, not if the ip matches the spf selector.

You could use a library such as spf-validate-dns to check if the IP matches. (I can't because it doesn't have types)

I have this error

[email protected]
verbose: Connection id c3eca05a-cd87-4f5a-bc9a-545961f44c75
info: c3eca05a-cd87-4f5a-bc9a-545961f44c75 Receiving message from [email protected]
{
id: 'c3eca05a-cd87-4f5a-bc9a-545961f44c75',
secure: true,
localAddress: 'ip',
localPort: 465,
remoteAddress: 'ip',
remotePort: 54252,
clientHostname: 'ns',
openingCommand: 'EHLO',
hostNameAppearsAs: '[127.0.0.1]',
xClient: Map(0) {},
xForward: Map(0) {},
transmissionType: 'ESMTPS',
tlsOptions: {
name: 'TLS_AES_256_GCM_SHA384',
standardName: 'TLS_AES_256_GCM_SHA384',
version: 'TLSv1.3'
},
envelope: {
mailFrom: { address: '[email protected]', args: false },
rcptTo: [ [Object] ]
},
transaction: 1,
mailPath: '.tmp\c3eca05a-cd87-4f5a-bc9a-545961f44c75'
}
info: c3eca05a-cd87-4f5a-bc9a-545961f44c75 Processing message from [email protected]
verbose: c3eca05a-cd87-4f5a-bc9a-545961f44c75 Validating dkim.
verbose: c3eca05a-cd87-4f5a-bc9a-545961f44c75 Validating spf.
verbose: validsting spf for host mail.index-dev.tech and ip [ip]
verbose: c3eca05a-cd87-4f5a-bc9a-545961f44c75 Parsing email.
parseEmail err: TypeError: Cannot set property errored of # which has only a getter
at new MessageSplitter (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailsplit\lib\message-splitter.js:24:22)
at new MailParser (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailparse\lib\mail-parser.js:33:25)
at module.exports (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailparse\lib\simple-parser.js:25:18)
at C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:312:36
at Promise._execute (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\debuggability.js:384:9)
at Promise._resolveFromExecutor (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:518:18)
at new Promise (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:103:10)
at parseEmail (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:307:16)
at C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:215:21
at tryCatcher (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:729:18)
at Promise._fulfill (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:673:18)
at Promise._resolveCallback (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:466:57)error: c3eca05a-cd87-4f5a-bc9a-545961f44c75 Unable to validate dkim. Consider dkim as failed.
error: Error: No header boundary found
at Object.verify (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\dkim\lib\verify.js:18:22)
at Object.validateDkim (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\mailUtilities.js:25:10)
at Object.tryCatcher (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\util.js:16:23)
at Object.ret [as validateDkimAsync] (eval at makeNodePromisifiedEval (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promisify.js:184:12), :13:39)
at validateDkim (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:260:30)
at C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:212:21
at tryCatcher (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:729:18)
at Promise._fulfill (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:673:18)
at Promise._resolveCallback (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:466:57) at Promise._settlePromiseFromHandler (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:559:17)
at Promise._settlePromise (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:649:10)
error: c3eca05a-cd87-4f5a-bc9a-545961f44c75 Unable to finish processing message!!
{
message: 'Cannot set property errored of # which has only a getter',
stack: 'TypeError: Cannot set property errored of # which has only a getter\n' +
' at new MessageSplitter (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailsplit\lib\message-splitter.js:24:22)\n' +
' at new MailParser (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailparse\lib\mail-parser.js:33:25)\n' +
' at module.exports (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailparse\lib\simple-parser.js:25:18)\n' +
' at C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:312:36\n' +
' at Promise._execute (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\debuggability.js:384:9)\n' +
' at Promise._resolveFromExecutor (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:518:18)\n' +
' at new Promise (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:103:10)\n' +
' at parseEmail (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:307:16)\n' +
' at C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:215:21\n' +
' at tryCatcher (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\util.js:16:23)\n' +
' at Promise._settlePromiseFromHandler (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:547:31)\n' +
' at Promise._settlePromise (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:604:18)\n' +
' at Promise._settlePromise0 (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:649:10)\n' +
' at Promise._settlePromises (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:729:18)\n' +
' at Promise._fulfill (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:673:18)\n' +
' at Promise._resolveCallback (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:466:57)'
}
error: TypeError: Cannot set property errored of # which has only a getter
at new MessageSplitter (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailsplit\lib\message-splitter.js:24:22)
at new MailParser (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailparse\lib\mail-parser.js:33:25)
at module.exports (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailparse\lib\simple-parser.js:25:18)
at C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:312:36
at Promise._execute (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\debuggability.js:384:9)
at Promise._resolveFromExecutor (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:518:18)
at new Promise (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:103:10)
at parseEmail (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:307:16)
at C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:215:21
at tryCatcher (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:729:18)
at Promise._fulfill (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:673:18)
at Promise._resolveCallback (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:466:57)Unhandled rejection TypeError: Cannot set property errored of # which has only a getter
at new MessageSplitter (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailsplit\lib\message-splitter.js:24:22)
at new MailParser (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailparse\lib\mail-parser.js:33:25)
at module.exports (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\mailparse\lib\simple-parser.js:25:18)
at C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:312:36
at Promise._execute (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\debuggability.js:384:9)
at Promise._resolveFromExecutor (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:518:18)
at new Promise (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:103:10)
at parseEmail (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:307:16)
at C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\node-mailin\lib\node-mailin.js:215:21
at tryCatcher (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:729:18)
at Promise._fulfill (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:673:18)
at Promise._resolveCallback (C:\Users\admin\Desktop\PRODUCT EMAN\mailing\node_modules\bluebird\js\release\promise.js:466:57)

Async/Await and DKIM verification.

Hi,

I love this package it works simple and efficient. I just want to know how I can verify my DKIM (keypair)? Since I know in HARAKA you need to HARAKA wich key you use. Also I wonder if I can use this in async/await?

What about webhooks?

I thought the ability to forward incoming mail via SMTP to an external web endpoint was the main feature of Mailin? What happened to webhook support with this project? Is it going to come back some day?

local time from sender

Hi,

Which field would it be to pull in the local time from where the email was sent please? I tried data.date which gave me a time string a few hours ahead of mine, but then also appended (GMT+0100 (British Summer Time)) which doesn't make sense.

May 27 16:22:18 Email Received! Sender local time might be: Thu May 27 2021 23:22:17 GMT+0100 (British Summer Time)

How to access email subject

Hi, thanks for the work to keep mailin up to date!

I'm struggling with interpreting the output of data.headers and for some reason unable to access console.log (data.headers.subject);

Is there something I'm missing?

Thanks

Upgraded to Node 14.17.0 now no emails

upgraded node, mailin still seems to start without complaint but I'm getting no actions logged when emails are sent.

I suspect it's because I needed to upgrade Node to use another package. Is there a way around this?

Thanks,

active?

Hi.

is this project active? the last PR seems to be in 2021 so does it even work today? can we expect it to work in future?

Thank you, but the email still does not arrive, the user of the email must be created somehow? or just put the email and password that I decide and send mails? here

    Thank you, but the email still does not arrive, the user of the email must be created somehow? or just put the email and password that I decide and send mails? here 

I get this on the console at the end
info: bc824758-d68e-4258-bb2d-118371ae736a End processing message, deleted .tmp\bc824758-d68e-4258-bb2d-118371ae736a

CODE:

nodeMailin.on("authorizeUser", function (connection, username, password, done) { if (username == "user" && password == "passs") { done(null, true); } else { done(new Error("Unauthorized!"), false); } });

Originally posted by @emanuelgamer011 in #39 (comment)

circular dependency warning on node v15.5

I get the following circular dependency warnings when running on node version 15.5

(node:1585) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1585) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'which' of module exports inside circular dependency

URGENT | Breaking Change | Cannot set property errored of #<Readable> which has only a getter

Hello Community,

Please note that there is a breaking change when using this package with Node.js 18+. In short, it works as expected with Node.js 16.7.x, however, will throw an uncaught error message: 'Cannot set property errored of # which has only a getter' on Node.js 18+.

I traced this error to node_modules/mailsplit/lib/message-splitter.js line 24. In short, the mailsplit package is required by mailparse, in which mailparse is required by node-mailin. It seems mailparse has not been updated in 5 years.

Can you take a look into this issue? Notice to anyone using 18+, it will simply not work any longer. You'll need to downgrade.

Thanks!

How to use in Node 18?

Hi, this library is awesome, and it works properly on node 16, but once I try using node 18, it does not work, giving the following error:

52|incomingMailHandler | error: dcde47b4-d132-450a-ba99-c761a52d19b2 Unable to finish processing message!! 52|incomingMailHandler | { 52|incomingMailHandler | message: 'Cannot set property errored of #<Readable> which has only a getter', 52|incomingMailHandler | stack: 'TypeError: Cannot set property errored of #<Readable> which has only a getter\n' + 52|incomingMailHandler | ' at new MessageSplitter (/app/node_modules/mailsplit/lib/message-splitter.js:24:22)\n' + 52|incomingMailHandler | ' at new MailParser (/app/node_modules/mailparse/lib/mail-parser.js:33:25)\n' + 52|incomingMailHandler | ' at module.exports (/app/node_modules/mailparse/lib/simple-parser.js:25:18)\n' + 52|incomingMailHandler | ' at /app/node_modules/node-mailin/lib/node-mailin.js:312:36\n' + 52|incomingMailHandler | ' at Promise._execute (/app/node_modules/bluebird/js/release/debuggability.js:384:9)\n' + 52|incomingMailHandler | ' at Promise._resolveFromExecutor (/app/node_modules/bluebird/js/release/promise.js:518:18)\n' + 52|incomingMailHandler | ' at new Promise (/app/node_modules/bluebird/js/release/promise.js:103:10)\n' + 52|incomingMailHandler | ' at parseEmail (/app/node_modules/node-mailin/lib/node-mailin.js:307:16)\n' + 52|incomingMailHandler | ' at /app/node_modules/node-mailin/lib/node-mailin.js:215:21\n' + 52|incomingMailHandler | ' at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)\n' + 52|incomingMailHandler | ' at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:547:31)\n' + 52|incomingMailHandler | ' at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:604:18)\n' + 52|incomingMailHandler | ' at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:649:10)\n' + 52|incomingMailHandler | ' at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:729:18)\n' + 52|incomingMailHandler | ' at Promise._fulfill (/app/node_modules/bluebird/js/release/promise.js:673:18)\n' + 52|incomingMailHandler | ' at Promise._resolveCallback (/app/node_modules/bluebird/js/release/promise.js:466:57)' 52|incomingMailHandler | }

How to reject an incoming email?

Is there a way to reject an incoming email?
For example if someone sends an email to the server you could check if it was send to [email protected] and if not, you could send an error like the one outlook sends if an email adress doesn't exist (550 5.1.10 RESOLVER.ADR.RecipientNotFound;)
~ Maxi

enable Spamassassin

Enabling spamassassin with change to /etc/default/spamassassin is not allowed anymore.
spamassassin

Prior to version 3.4.2-1, spamd could be enabled by setting
ENABLED=1 in this file. This is no longer supported. Instead, please
use the update-rc.d command, invoked for example as "update-rc.d
spamassassin enable", to enable the spamd service.

Missing fields in the mailinMsg received in the "message" event

hi,
i'm upgrading the package passing from mailin to "node-mailin" but a lot of things changed like the structure of the mailinmsg for instance.

Can you provide an exemple of what we expect as a mailingMsg in this version please ?

For example i'm looking for the priority that was in the "old" mailinMsg

{
  "mailinMsg":
  {
     ...
      "priority": "normal", // I need this but can"t find it in data
     ...
}

Best regards,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.