Code Monkey home page Code Monkey logo

grunt-nodemailer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

grunt-nodemailer's Issues

Can't configure for Office365

Has anyone been able to get this repo working with Office365? I can't find any working examples and have only been able to get it to work with gMail but we use office for work so trying to find a way to get this working.

Appreciate any insight you can provide!

Using "sendmail" transport resulting in "spawn sendmail ENOENT" error

I want to inline the email HTML and send it to myself.

The inliner works fine, but I keep getting spawn ENOENT error whenever I want to send the email.
My node is on v0.12.7 and I'm using Windows 10.

Here's what shown in CLI:

Running "nodemailer:send" (nodemailer) task
Sending 1 e-mail to recipients: "Me" <[email protected]>

Fatal error: Error occured: spawn sendmail ENOENT

Here's my Gruntfile:

"use strict";

module.exports = function(grunt) {
  grunt.initConfig({
    ...
    nodemailer: {
      send: {
        src: ["index.html"]
      },
      options: {
        transport: {
          type: "sendmail"
        },
        message: {
          subject: "Test email",
          from: "<Test> [email protected]"
        },
        recipients: [{
          email: "[email protected]",
          name: "Me"
        }]
      },
    }, //end nodemailer
      ...
  } //end initConfig

  grunt.loadNpmTasks("grunt-nodemailer");
  grunt.registerTask("send", function() { // the command is `grunt send`
    grunt.task.run([
      "juice:inliner", // I use juice to inline css, it works fine
      "nodemailer:send"
    ]);
  });

} //end module.exports

Can't I send email from localhost? Or is there a mistake in my configuration? I tried using Gmail just like the example and works fine.

Thanks

Note: I posted this issue on Stackoverflow. So far, there's no reply.

Fatal error: Error occured: spawn ENOENT

When I try send mail from 'sendmail transport' in terminal I see this:

Running "nodemailer:task" (nodemailer) task
Sending 1 e-mail to recipients: [email protected]
Fatal error: Error occured: spawn ENOENT

When I use filestub transport, my message sended

Windows 7 x64
node 0.10.30

Image attachment has no data

Hey there,

Despite all the hair I've pulled outta my head over the last few hours, I love nodemailer :) I'm trying to send an image attachment and it's coming through, but with no data. 0kb in size. That's using this code:

var path = require('path');
var uploadDir = path.dirname(require.main.filename); 
// This actually produces a filepath that starts at my /Applications dir on my Mac, but ends in the right spot.

var img = require("fs").readFileSync(uploadDir + '/uploads/' + params.newFileName);
// file was upload was handled on the server by multer and renamed to something like this: fc5c5921bd0892f114cd7b6f0d39d9a3.gif

attachments: [{
    filename: params.newFileName,
    filePath: img
}]

The image is in the directory, and there are no explicit errors. When I replace filePath above with path (as it's written in some places), I get an attachment called attachment-1.bin. I've also tried setting my img var as a value of the content property in the attachments object, to no avail. In fact I've probably tried about a hundred variations on the theme with no luck.

False positive when running nodemailer grunt task

When running

grunt -v acceptance-nightly

with the following excerpt from the gruntfile.js:

grunt.loadNpmTasks('grunt-nodemailer');
grunt.initConfig({
nodemailer: {
// Task-specific options go here.
options: {
trasport: {
options: {
host: 'outlook.corp.local'
}
},
message: {
subject: 'subject',
text: 'text'
},
recipients: [
{
email: '[email protected]',
name: 'John Doe'
}
]
}
}
});
grunt.registerTask('acceptance-nightly',['nodemailer']);

I received the following success message in the console:

Done, without errors.

whereas I expected to see the following printed to the console in addition to an error if the email task failed:

'Sending %d e-mail%s to recipients: %s'

Fatal error: Error occured: connect ECONNREFUSED 127.0.0.1:25

After I`d updated to version 1.0.0.0
I got next error each time
Fatal error: Error occured: connect ECONNREFUSED 127.0.0.1:25

I revert to 0.3.0, the problem was fixed.

Is there any global problem or I should change something in my settings or properties

Fatal error when trying to send html email

This is my current config:

nodemailer: {
    options: {
        transport: {
            type: 'SMTP',
            service: 'Gmail',
            auth: {
                user: 'my_gmail_user',
                pass: 'my_password'
            }
        },
        recipients: [
            {
                name: 'Test User',
                email: '[email protected]'
            }
        ]
    },
    dist: {
        src: ['dist/index.html']
    }
}

However running grunt nodemailer throws the following error:

Running "nodemailer:dist" (nodemailer) task
Sending 1 e-mail to recipients: "Test User" <[email protected]>
Fatal error: Error occured: Error

It used to work fine when I used your custom send task, I read the docs but I couldn't find anything wrong maybe it's related to the "message" option? It should still be able to send with the "src" option correct?

Can't send an attachment via Node-Mailer?

I just can't have an attachment send via grunt node-mailer task.

My code looks like:

message: {
subject: 'A test e-mail',
text: 'Plain text message',
html: '

HTML custom message

',

     attachments : [
      {   // file on disk as an attachment
        filename: 'samtest.txt',
        path: 'samtest.txt' // stream this file
      },
    ],

    alternatives : [
      {   // file on disk as an attachment
        filename: 'samtest.txt',
        path: 'samtest.txt' // stream this file
      },
    ],

    },

I see no errors when I run the nodemailer task. I even receive the email, but without any attachment. What am I missing?

This is how my transport property looks like:

transport: {
type: 'SMTP',
options: {
service: 'Gmail',
auth: {
user: 's*******@gmail.com',
pass: ''"
}
}
}

Display error name instead of error message

When error occur, you see line like this:
Fatal error: Error occured: Error

If you change error.name to error.message in line:
grunt.fail.fatal('Error occured: ' + error.name);

you will see the error itself instead of just 'Error'.
After changing this you can see for example:
Fatal error: Error occured: Authentication required, invalid details provided

Doesn't work with Sendgrid transport

I am getting the error mail.message.getAddresses is not a function.

I tried upgrading nodemailer to 2.3.0, but I received the error Error occured: Missing email body. I tried using 0.1.0 for the nodemailer-sendgrid-transport, and it still has the same issue.

Any ideas?

Invalid external files should fail gracefully

I had missed this line in the documentation:

Accepted file extensions are .html, .htm and .txt.

and was trying to use a .json file as the body of my email.
The failure I was getting was:
Fatal error: Error occured: Can't send mail - no recipients defined
because the message was false.

One option would be to improve the if/else if clause to better handle different file types (or at least log the file types are invalid).
Another option would be to add a test condition to async.eachSeries(messages, function (msg, next) {

        if (!msg) {
            grunt.fail.fatal('No message to send.');
        }

Attachment is not sent, unless value of 'filePath' key is hardcoded.

None values from below does not work except first

...
                     attachments: [{                                             
                         //filePath: 'build/output/ads.dev.master-61.ajs'        
                         //filePath: grunt.config('vars.mail.attachment')        
                         //filePath: grunt.file.expand('<%= vars.dest %>/*')[0]  
                         //filePath: grunt.file.expand(grunt.config('vars.dest') + '/*')[0]
                     }]                                                          
...

Any idea how to make this does its job?

Overwrite subject?

Can you set a subject in the message option if you're using a html file for the src?

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.