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 => “[email protected]”,
: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(“[email protected]”,“[email protected]”,“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” ,“[email protected]”," "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:ingetok’
from e:/ruby/lib/ruby/1.8/net/smtp.rb:635:in rcptto' from e:/ruby/lib/ruby/1.8/net/smtp.rb:546:insend0’
from e:/ruby/lib/ruby/1.8/net/smtp.rb:545:in each' from e:/ruby/lib/ruby/1.8/net/smtp.rb:545:insend0’
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:inperform_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:instart’
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:insend’
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:inmethod_missing’
from E:/TradingTools/CODE/scanForex.rb:46

On Dec 23, 12:21 pm, Junkone [email protected] wrote:

#{:address => “smtp.example.com”,
def sendmsg(to, sender, subj, content, strip_ext = true)
#attachment :content_type => content_type,
class
from e:/ruby/lib/ruby/1.8/net/smtp.rb:545:in each' from e:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.3.5/lib/ action_mailer/base.rb:451:indeliver!’
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

ignorethis post. this actually works. i had a nil email id to send

On Mon, 24 Dec 2007 03:14:58 +0900, Junkone wrote:

ignorethis post.

Not at all, it was quite interesting and gives food for thought :slight_smile:

-Thufir

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs