10

I'm using the Zapier Code application, I need to send an email receiving trello parameters, I'm using a javascript encoding along with node.js, but when I try to find the nodemailer module I always get the error that it can not be found.

The error always points to this line of code:

var nodemailer = require ('nodemailer');
Harshith Rai
  • 3,018
  • 7
  • 22
  • 35
Fabio Sousa
  • 261
  • 1
  • 2
  • 11
  • Did you try something like [this](https://zapier.com/app/editor/template/131)? If you need more control on the data, you can put some Javascript in between. – webwurst May 21 '17 at 00:29

5 Answers5

20

It sounds like you have not installed nodemailer from npm. Navigate to your project folder through a command line terminal and install nodemailer with the below command. If you have a package.json file (and you probably should), you can use the --save flag to record the version you install with your app.

npm install nodemailer --save

Note that nodemailer requires Node.js version 6+ to work correctly. Check your Node.js version with node --version on Windows or OSX and nodejs --version on linux.

Since you're asking this question, you will probably benefit from reading about npm here: https://www.npmjs.com/get-npm

Your package.json file should have the following dependency. You may have to adjust version number to match Zapier requirements.

{
  "dependencies": {
    "nodemailer": "^4.0.1"
  }
}

Upon browsing the Zapier website, it looks like they offer tech support even for free customers. You may consider contacting them directly if this does not resolve your issue.

ThisClark
  • 14,352
  • 10
  • 69
  • 100
  • Hello friend thank you very much for your attention I am using the Zapier Code application and in the documentation it informs that it supports Node 4.3.2, do you think I can accomplish my action with these features? – Fabio Sousa May 15 '17 at 14:52
  • Are you able to determine the version of Nodemailer that you are using? Is there a record of the version anywhere in your application? I know the Nodemailer website says Nodemailer version 4+ requires Node.js version 6+ https://nodemailer.com/about/ – ThisClark May 15 '17 at 14:58
  • I can tell the version of node.js that is supported through the application documentation that is available at this link: https://zapier.com/help/code/ (By searching for "node" on the page, the first result already shows the version). Does this help in any way? – Fabio Sousa May 15 '17 at 15:04
  • Everywhere I look in the Nodemailer documentation says Node.js 6+ is wanted for version 3 and up. Version 2 of nodemailer is no longer supported. You could try setting the package.json dependency to version 2 and see if you have any success. – ThisClark May 15 '17 at 15:10
  • You are helping me after 3 hours of searching. Thanks. – AMMAR ELHAMDO Apr 13 '22 at 11:32
1

First ensure you call npm install nodemailer --save at project root.

Then replace

Var nodemailer = require ('nodemailer');

with

var nodemailer = require('nodemailer');

Stephane Janicaud
  • 3,531
  • 1
  • 12
  • 18
1

You can't import npm modules in "Zaps": Requiring or Using External Libraries

webwurst
  • 4,830
  • 3
  • 23
  • 32
0

Use this :

npm install nodemailer

And your var nodemailer = require ('nodemailer') will work.


https://docs.npmjs.com/getting-started/installing-npm-packages-locally

https://www.npmjs.com/package/nodemailer

0

Make sure you have a dependency in package.json inside functions Make sure you have a dependency in package.json inside functions

Mudassar Ashraf
  • 734
  • 7
  • 8