According to the latest This Week in Meteor newsletter a pull request from tomarcafe was merged into Meteor that makes it possible to send attachments.
This is exactly what I am needing at the moment but it’s not working for me even after a meteor update. I’m using the Windows build.
// Let other method calls from the same client start running,
// without waiting for the email sending to complete.
this.unblock();
Email.send({
to: to,
from: from,
subject: subject,
html: html,
attachments : attachments
});
}
anybody?? please… i have no answer to this as of now… it can only attach text file other than that nothing… i need to implement inline embedded images…
yep. as per my last post i already solved my own problem, the reason for my struggle is that the parameter posted on the manual is ambiguous. so i finally made it work using trial and error
Yeah, I was using fileName and filePath as my keys. No luck. The docs say it’s supposed to be an array of objects, but I’m entering something like: { fileName: “Demographics.numbers”, filePath: “Macintosh\ HD/Users/Opal/Desktop/Demographics.numbers” }. I’m stumped.
Is that the actual filePath you are using? Or similar to it? Depending on what problem/error you are having, it may be an issue with the filePath, as a path starting with “Macintosh\ HD” seems unlikely to be found as Macintosh HD is in the Volumes directory, so “/Volumes/Macintosh\ HD/” would be absolute, and a relative path like you have seems unlikely to work unless your Meteor project is in just the right directory.
Otherwise, what everyone is saying should work.
If you have an array of attachment objects with correct name and path, you should be able to attach them.
You solved it, soitech. Huge thanks. It turns out I had two problems: The file path, as you pointed out, and I had “attachment” instead of “attachments” listed in the function. One observation its that Apple numbers files, although the WILL attach, they don’t fully attach, as in they can’t be opened. Other files that I’ve tried that succeeded were .png, .xlsx, rtf, txt files. Not sure if this has something to do with the .numbers extension?
It may not know the mime type for .numbers files.
According to the documentation here each attachment object has an optional contentType property, and if not set, the content type will be derived from the fileName. So for fairly standard extensions, it is probably able to get the extension from the file name and set the correct mime-type data, but it probably doesn’t have every possible extension available.
The documentation doesn’t give any info on supported content types, so it would probably require some experimentation to set the contentType yourself. A quick search turned up ‘application/x-iwork-numbers-sffnumbers’ as a possible mime-type for .numbers files. So you might try adding contentType:'application/x-iwork-numbers-sffnumbers' to your attachment object for .numbers files and see if that works, or do a more thorough search to see if you can find the correct mime-type for those files.
I would imagine that the app I’m building would need to provide the user with a selector to confirm a “numbers” attachment, and thus insert the contentType value.