Ezra Zygmuntowicz
2006-Jun-30 03:51 UTC
[Backgroundrb-devel] Fwd: Need to send email from a worker
Begin forwarded message:> From: Ezra Zygmuntowicz <ez at brainspl.at> > Date: June 29, 2006 8:18:10 PM PDT > To: Douglass Turner <douglass.turner at gmail.com> > Subject: Re: [Backgroundrb-devel] Need to send email from a worker > > > On Jun 29, 2006, at 7:45 PM, Douglass Turner wrote: > >> Hello, >> >> Can someone suggest the simplest way to send email from a worker? >> At completion, I need to send the results of it''s work to a >> recipient. >> >> Thanks, >> Doug Turner >> skype: dduuggllaa >> _______________________________________________ >> Backgroundrb-devel mailing list >> Backgroundrb-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/backgroundrb-devel > > > The simplest way to do that is probably to use net/smtp. Or you > could use your actionmailer class in the worker but that requires > you to load pretty much all of rails in your drb server which is > not very resource friendly. If its just a simple text email then I > would just use net/smtp like so: > > msgstr = <<END_OF_MESSAGE > From: Your Name <your at mail.address> > To: Destination Address <someone at example.com> > Subject: test message > Date: Sat, 23 Jun 2001 16:26:43 +0900 > Message-Id: <unique.message.id.string at example.com> > > This is a test message. > END_OF_MESSAGE > > require ''net/smtp'' > Net::SMTP.start(''your.smtp.server'', 25) do |smtp| > smtp.send_message msgstr, > ''your at mail.address'', > ''his_addess at example.com'' > end > > > Cheers- > -Ezra-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060629/d3956f1f/attachment-0001.html