ruby - Actionmailer - heroku app -


this newbie question please excuse me, have been working rails, first time trying require gems heroku app not include rails - plain ruby app. ok have app.rb file looking this:

require "sinatra" require 'koala' require 'action_mailer' actionmailer::base.raise_delivery_errors = true  actionmailer::base.delivery_method = :smtp actionmailer::base.smtp_settings = {    :address   => "smtp.sendgrid.net",    :port      => 587,    :domain    => "mydomain",    :authentication => :plain,    :user_name      => "user_name",    :password       => "password",    :enable_starttls_auto => true   } actionmailer::base.view_paths= file.dirname(__file__)  class testmailer < actionmailer::base    default :from => "my_email"    def welcome_email     mail(:to => "my_email", :subject => "test mail", :body => "test mail body")   end end 

what run

testmailer::deliver_test_email 

in console , details or run

testmailer::deliver_test_email.deliver 

to send test email

but :

nameerror: uninitialized constant object::testmailer 

i have included actionmailer in gemfile , in gemfile.lock

i sure straight forward experienced ruby dev, struggling me please?

thanks

after few hours of testing , research ended using mail instead, final code when run works fine, hope helps having same issues :)

require 'mail'  mail.defaults    delivery_method :smtp, { :address   => "smtp.sendgrid.net",                             :port      => 587,                            :domain    => "my_domain",                            :user_name => "user_name",                            :password  => "password",                            :authentication => 'plain',                            :enable_starttls_auto => true } end  mail = mail.deliver   'email'   'your name <name@my_domain>'   subject 'this subject of email'   text_part     body 'hello world in text'   end   html_part     content_type 'text/html; charset=utf-8'     body '<b>hello world in html</b>'   end end 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -