Bob Schäfer
9/4/2008 1:13:00 PM
loominator1970 wrote:
> I'm trying to find some code to send an email with attachment in
> ruby. I'm using the following code to send an email, but I would like
> to send an PDF. Can someone please tell me what code i need to add to
> include a file called "the_attachment.pdf"? Thanks, Dave
> [snip code example]
/usr/ports/mail/mutt-lite installed.
well, i know it's low-brow, but i've been doing it like this:
system("cat #{bodyfile} | mutt -s #{subjectstring} -a #{attachmentfile}
#{recipient}")
keep in mind, this is on FreeBSD servers with mutt installed.
# cd /usr/ports/mail/mutt-lite && make install clean
also, if you call this from cron (who wouldn't) you'll need to put the
full path of mutt in your system call, typically /usr/local/bin/mutt.
if there's a *ruby way* to do this, i'd love to know what it is. i
always feel a little dirty doing it like this.