dwightjack / grunt-nodemailer

Grunt wrapper for Nodemailer
MIT License
9 stars 4 forks source link

Fatal error when trying to send html email #1

Closed jahvi closed 10 years ago

jahvi commented 10 years ago

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: 'test@email.com'
            }
        ]
    },
    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" <test@email.com>
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?

dwightjack commented 10 years ago

It could be a problem in the transport configuration. In latest versions i've changed the signature to a type + option object (see https://github.com/dwightjack/grunt-nodemailer#optionstransport).

Your configuration should be:

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

Hope this will solve the problem. Keep me posted.

jahvi commented 10 years ago

Thanks I did notice that like 10 seconds after posting the issue :disappointed_relieved:

I just updated the generator to use grunt-nodemailer and grunt-premailer in the develop branch https://github.com/jahvi/generator-htmlemail/tree/develop

Feel free to take a look and let me know if you see anything that's worth changing.