From: Junkone Date: 2007-12-24T02:24:57+09:00 Subject: strange issue iwth sending smtp with gmail Hello When i use this class and execute it, it works fine. i am able to send email thro gmail. however it does not work if i call this method from another class. i get a smtp error. dunno what the reasons are. i am attaching the working file and not working file. require "action_mailer" require "smtp_tls" #ActionMailer::Base.smtp_settings = #{:address => "smtp.example.com", # :domain => "example.com"} class GmailMailer < ActionMailer::Base ActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :authentication => :plain, :user_name => "user@gmail.com", :password => "password" } def sendmsg(to, sender, subj, content, strip_ext = true) #standard ActionMailer message setup recipients to from sender subject subj #setting the body explicitly means we don't have to provide a separate template file body content ##set up the attachment #attachment :content_type => content_type, # :body => File.read(file_name), # :filename => file_name.gsub(/.*\//,'') end end GmailMailer.deliver_sendmsg("anotheremail@hotmail.com","user@gmail.com","hello this is a test","this is a body") # The above class works as long as the GmailMailer.deliver is called with thin the fine. However the following does not work at all if i call it from another class GmailMailer.deliver_sendmsg( "another email address" ,"user1@gmail.com"," "sometext ","some more text") I get the following error. e:/ruby/lib/ruby/site_ruby/1.8/xmlconfigfile.rb:646: warning: parenthesize argument(s) for future version e:/ruby/lib/ruby/1.8/net/smtp.rb:680:in `check_response': 555 5.5.2 Syntax error n63sm12043118pyh.5 (Net::SMTPFatalError) from e:/ruby/lib/ruby/1.8/net/smtp.rb:653:in `getok' from e:/ruby/lib/ruby/1.8/net/smtp.rb:635:in `rcptto' from e:/ruby/lib/ruby/1.8/net/smtp.rb:546:in `send0' from e:/ruby/lib/ruby/1.8/net/smtp.rb:545:in `each' from e:/ruby/lib/ruby/1.8/net/smtp.rb:545:in `send0' from e:/ruby/lib/ruby/1.8/net/smtp.rb:472:in `sendmail' from e:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.5/lib/ action_mailer/base.rb:567:in `perform_delivery_smtp' from e:/ruby/lib/ruby/1.8/net/smtp.rb:379:in `start' from e:/ruby/lib/ruby/1.8/net/smtp.rb:316:in `start' from e:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.5/lib/ action_mailer/base.rb:565:in `perform_delivery_smtp' from e:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.5/lib/ action_mailer/base.rb:451:in `send' from e:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.5/lib/ action_mailer/base.rb:451:in `deliver!' from e:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.5/lib/ action_mailer/base.rb:333:in `method_missing' from E:/TradingTools/CODE/scanForex.rb:46