Reputation: 4679
I want to generate Email from my ruby application, So i used Action mail class for that.
I configured the Email setting on environment.rb my configuration is as follows
ActionMailer::Base.raise_delivery_errors = false
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "mail.authsmtp.com",
:port => 2525,
:user_name => "*******",
:password => "*******",
:authentication => :login
}
My mailer model is TestMailer,so i decided to check the mail operation so define method on TestMailer.rb.
def test_mail(to) {
subject "My first email!"
recipients "#{to}"
from 'test'
charset "utf-8"
content_type 'text/html'
body "Testing one two three..."
}
I opened the ruby Script/console and called the test_mail method by TestMailer.deliver_test_mail("[email protected]")
.
It is not generating the email. In the application server log its generates the email template.
I have no clue whats is the probs here .
Upvotes: 0
Views: 215
Reputation: 7105
If you ran this:
ruby script/console
... then you're in development mode, which probably has "perform_deliveries = false" or some other setting for delivery_method
Instead, run the console in production mode:
ruby script/console production
... or change config/environments/development.rb to "perform_deliveries = true".
Note this comment from environment.rb:
# Settings in config/environments/* take precedence over those specified here.
So, if something is defined in both places, it'll be overridden by the environment specific setting!
Upvotes: 0
Reputation: 3309
You should check config/environments/development.rb | test.rb | production.rb (depending on how you launched you console)
And verify if it does not overrides the smtp setting you have in environment.rb
Upvotes: 1