Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mailin/test/utils/server.js outdated? #25

Closed
tekbyte opened this issue Oct 27, 2014 · 9 comments
Closed

mailin/test/utils/server.js outdated? #25

tekbyte opened this issue Oct 27, 2014 · 9 comments

Comments

@tekbyte
Copy link

tekbyte commented Oct 27, 2014

Hello there and thanks for sharing mailin!
I am quite new to node.js, but I think the server.js script is outdated for current version of the Express API?
I would like to test the webhook using this code :) Any help is appreciated!

@Flolagale
Copy link
Owner

Right it might not be compatible with the current express version. I'll have a look at it. Btw, the mailin.io demo is down until tomorrow for maintenance, just in case you tried it. :-)

@tekbyte
Copy link
Author

tekbyte commented Oct 27, 2014

Indeed I did try. I have tried the demo earlier last week though ;) Loved it!
By the way, I have figured out this much:

Error: 'app.router' is deprecated!
Please see the 3.x to 4.x migration guide for details on how to update your app.
    at Function.Object.defineProperty.get (/Users/adm/Sandbox/webexp/node_modules/express/lib/application.js:91:13)
    at Object.<anonymous> (/Users/adm/Sandbox/webexp/server.js:12:18)
    at  [...]

Issue: (in server.js):
var server = express();
server.use(server.router); // >> removed from Express 4.x << (removing this line seems to help me further)

At this point I get the following error:
/Users/adm/Sandbox/webexp/bin/www:5
app.set('port', process.env.PORT || 3000);
    ^
TypeError: Object #<Object> has no method 'set'
    at Object.<anonymous> (/Users/adm/Sandbox/webexp/bin/www:5:5)
    at [...]

At this point I cant figure out what's the trouble. I've tried stuff, but as I said I'm not too sturdy in node.js yet ;)

@Flolagale
Copy link
Owner

That's because this example script uses the old express API which has been deprecated with express 4. I'll update this example. By this time, you can follow an express tutorial, it'll really help you getting started and it really worth it if you want to invest in node!

@tekbyte
Copy link
Author

tekbyte commented Oct 30, 2014

Thanks! I am doing some tutorials now. ;-)

@tekbyte
Copy link
Author

tekbyte commented Nov 11, 2014

Hello again Flolagale :)
I have managed to run the script smoothly. But I have a question regarding domain validation check. Is it possible to bypass or disable domain check of senders e-mail?
"Sender address rejected: Domain not found" that is. I am currently developing in an environment where this is fine, but deployment of this script be in a network where I have no interest in domain validity for sender (or reciever actually), and this local network almost purely static IP's within range, and the far-away DNS and domain is something this application has no direct opportunity to chit-chat with. :)
Any thoughts? I've read some code and I presume a python script does this checkup.

@Flolagale
Copy link
Owner

If you use mailin inside a node app (I mean not from the command line), there is an option to disable sender validation. Here comes the gist of it:

var mailin = require('mailin');
mailin.start({
  port: 25,
  webhook: 'http://yourdomain.com/mailin-webhook',
  smtpOptions: {
    disableDNSValidation: true
  }
});

There is currently no option to do this from the command line. I'd recommend putting thiis gist in a file and running it with forever:

sudo npm install -g forever
forever start thefile.js

The other option is that you submit a pull request adding this option to the mailin cli ;-).
Hope this helps.

@tekbyte
Copy link
Author

tekbyte commented Nov 11, 2014

This is perfect! I need to learn to read the docs better before I ask! Thanks anyway! Consider this issue solved ;)

@Flolagale
Copy link
Owner

No worries, this one is not really documented ;-)
Glad that is suits your needs anyway. I'm closing this issue.

@Jmlevick
Copy link

Just made a pull request tackling this issue:

#38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants