Code Monkey home page Code Monkey logo

Comments (3)

dwightjack avatar dwightjack commented on June 12, 2024

Hi,

i didn't try any of the combination, anyway a quick fix would be to use the __dirname global to point to the folder where your Gruntfile resides.

With path module you can have cross platform path format too:

var  path = require('path');
console.log(path.normalize(__dirname + '/path/file.txt'));

from grunt-nodemailer.

ZuBB avatar ZuBB commented on June 12, 2024

Hi!

Your comment did not help me, but still get a hint to me where to go.. But I could not get anything of it

Best case which get some info is next

                     attachments: [{                                             
                         filePath: __dirname + grunt.file.expand(grunt.config.get('vars.dest') + '*')[0]
                     }]                                                          

In the log there is next line

Running "nodemailer:send" (nodemailer) task
[D] Task source: /home/vv/work/own/js/uos/ads/node_modules/grunt-nodemailer/tasks/nodemailer.js
Verifying property nodemailer.send exists in config...OK
File: [no files]
Options: transport={"type":"SMTP","options":{"service":"Gmail","auth":{"user":"[email protected]","pass":"..."}}}, message={"from":"...","to":"...","cc":"","bcc":"","subject":"ads: new developer build","text":"\n\nEmail sent by ASH robat v2.","attachments":[{"filePath":"/home/vv/work/own/js/uos/adsundefined"}]}, recipients=[], from="", subject="", html="", text=""
Sending 1 e-mail to recipients: ...
Message sent successfully.

Its obvious that second part of filepath value is 'broken'. All examples that I found in the internet is using static pathes (or hardcoded; same as you btw). I am sending with help of grunt file that has dynamic name. Today this is build/output/ads.dev.master-61.ajs and tomorrow that will be build/output/ads.dev.master-62.ajs for example.

I tried different cases and it looks like that grunt's config (and its values respectively) becomes unavailable at some level.

Hope you will give me one more hint because I am out of ideas..

from grunt-nodemailer.

ZuBB avatar ZuBB commented on June 12, 2024

Just for the record I was able to get this working with next line

  7         grunt.config('nodemailer.options.message.attachments',                  
  6             [{filePath: grunt.file.expand(grunt.config('vars.dest') + '*')[0]}]);

from grunt-nodemailer.

Related Issues (15)

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.