From: peter Date: 2007-03-12T09:20:10+09:00 Subject: Re: Help with NET::SMTP 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. On Mon, 2007-12-03 at 07:45 +0900, Rick DeNatale wrote: > On 3/11/07, peter wrote: > > I'm trying to use Net::SMTP which appears to do most everything I need > > except for one thing. In the example below I need to replace > > recipient@host.com with a variable based on the submitting users email > > address #{email) but nothing I have tried works. In most cases I get a > > tainted sender error. How can I use this and have a variable recipient? > > > > Net::SMTP.start('mail', 25) do |smtp| > > smtp.open_message_stream('sender@mail.com', ['recipient@host.com']) do | > > f| > > f.puts "From: sender sender@mail.com" > > f.puts "To: #{name} #{email}" > > It looks like the problem might be that the recipient email in the > header doesn't match the one you gave when you opened the stream. > > Assuming that the email variable contains the real recipient , have you tried: > smtp.open_message_stream('sender@mail.com', [email]) do | > f| > f.puts "From: sender sender@mail.com" > f.puts "To: #{name} #{email}" > ... > >