Hi Rick

I was hoping I could use this as a simple form mailer but I'm starting
to think that that is not possible.

In the open_message_stream you need a from and to. In my case the to is
a variable in eruby #{email}. Everything I have tried either results in
tainted to or security error.

Bits of code.

require 'digest/md5'
require 'net/smtp'
require 'cgi'
email = cgi['email'].strip

Form posts to self. The variable is email.

Net::SMTP.start('mail', 25) do |smtp|
smtp.open_message_stream('sender / mail.com', ['email']) do |
f|
f.puts "From: sender sender / mail.com"
f.puts "To: #{name} #{email}"
f.puts "Subject: Test"
f.puts "Date: #{t}"
f.puts
f.puts "#{name}\n\nTest Email!\n\n"   
end


On Mon, 2007-12-03 at 21:47 +0900, Rick DeNatale wrote:
> On 3/11/07, peter <ruby / iwebsl.com> wrote:
> > Hi Rick
> > Thanks for the response. I tried it just to check but that does not
> > work . The var email comes from a web form and does match the To however
> > I think the real problem is that the to is in an array and the array
> > does not allow for a variable. This is very odd though because it would
> > be extremely limiting to not be able to set these values as vars.
> 
> Can you show a bit more of your code.
> 
> I'm not sure what you mean by "I think the real problem is that the to
> is in an array and the array does not allow for a variable."
> 
> In my suggested line:
> smtp.open_message_stream('sender / mail.com', [email])
> 
> [email] will make and array containing one element which is the object
> (presumably a String) referenced by the variable email.  Now if email
> ISN'T a string but is some other object, then perhaps [email.to_s]
> would work.
> 
> I've never played with NET::SMTP, but this is basic Ruby stuff.
>