Kevin Smith <kevins14 / pacbell.net> writes:

> >    Net::SMTP.start(server) do |smtp|
> >      smtp.sendmail(message, from, [ to ])
> >    end
> >
> Thanks for the tip. My original implementation assumed that message
> was an array, not a string. I rewrote it using your approach, and
> using a string with "\n" terminated lines, and it seems to work
> fine.

In fact you could have left it as an array of lines. It would respond
to #each by returning each line, which would then be written by
sendmail. Array, String, File: anything that supports each could be
used as the first argument. I just wrote an autoresponder that had the 
following:

     def greet(address)
       File.open(GREETING) do |greeting|
         Net::SMTP.start do |smtp|
           smtp.sendmail(greeting, 'greeter@localhost', [ address ])
         end
       end
     end

Gotta love it.


Dave