You might try with absolute paths:

template: __dirname + "/templates/sample.txt"

2012. március 17., szombat 10:04:10 UTC+1 időpontban Angelo Chen a 
következőt írta:
>
> Hi, 
>
> I'm trying to use node_mailer(https://github.com/Marak/node_mailer), 
> the sample works, when following code is inside app.js and there is a 
> templates folder in the same level as app.js 
>
>    email.send({ 
>       subject : "node_mailer test email", 
>       template : "./templates/sample.txt",   // path to template name 
>       data : { 
>         "username": "Billy Bob", 
>         "color": function(){ 
>           var arr = ["purple", "red", "green", "yello"]; 
>           return arr[Math.floor(Math.random()*3)]; 
>         }, 
>         "animal": "monkey", 
>         "adverb": "quickly", 
>         "noun": "hot lava" 
>       }, 
>
>     }, 
>     function(err, result){ 
>       if(err){ console.log(err); } 
>     }); 
>
> when I create a module under a folder 'services', so I need to change 
> the template path to: 
>
>  template : '../templates/sample.txt',   // path to template name 
>
> I start to get: 
>
> { [Error: ENOENT, no such file or directory '../templates/sample.txt'] 
> errno: 34, code: 'ENOENT', path: '../templates/sample.txt' } 
>
> if I put sample.txt in the same folder as my module, and change it to 
>
>  template : 'sample.txt',   // path to template name 
>
> still getting error: 
>
> { [Error: ENOENT, no such file or directory 'sample.txt'] errno: 34, 
>
>
> any idea how to fix this? 
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to