From: Dave Lilley Date: 2010-07-28T18:51:04+09:00 Subject: net/smtp I am not sure if I've properly understood things correctly but.... I am trying to emulate sample code in the RDOC's of ruby core. can some one assist? Error is... ./barcode_class_rpt_email.rb:199:in `send_email': wrong number of arguments (5 for 4) (ArgumentError) code that generate this is this... require 'sendemail' def init @email = Sendemail.new lots of code between and in a fxruby class (don't know if this is an issue). 198 uname.each do |receipiant| 199 @email.send_email(@sender,receipiant, 'Automatic Patrol Report', @msg, @server) end the called script (it is referenced correctly). # sendemail.rb require 'net/smtp' class Sendemail def send_email(from, to, subject, message, server) Net::SMTP.start("#{server}", 25) do |smtp| smtp.set_debug_output $stdout smtp.open_message_stream("#{from}", "#{to}") do |f| f.puts "From: #{from}" f.puts "To: #{to}" f.puts "Subject: #{subject}" f.puts f.puts "#{message}" end end end end =begin #test code for the class commented out when trying to use within project a = Sendemail.new a.send_email "isp.email.address", "online@yahoo.com", "test", "a message", "smtp.isp.mail.server" =end I have changed the calling code (shown again below) @email.send_email(@sender,receipiant, 'Automatic Patrol Report', @msg, @server) to code below thinking the code below will fix things to no avail. @email.send_email("#{@sender}","#{receipiant}", "Automatic Patrol Report", "#{@msg}", "#{@server}") Why? I am sending across 5 parameters, see the test case above it works! it I for go 1 parameter then it works, but which one do I loose and why that one? I want the class to be as dynamic as possible so I can "just" call it into another project I want to send emails out from. any help appreciated. dave -- Posted via http://www.ruby-forum.com/.