I've tried everything I can think of to get emails to send with Rails 4.1.6 (local development) but nothing is working. Using Postmark I have the following in my development.rb and application.rb:
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_key => API_KEY }
config.action_mailer.perform_deliveries = true
and for GMAIL I tried:
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'gmail.com',
user_name: 'my_email',
password: 'my_password',
authentication: 'plain',
enable_starttls_auto: true }
My Mailer class looks like so:
class BusinessMailer < ActionMailer::Base
default from: "[email protected]"
def claim_business business
mail(
:subject => 'hello',
:to => '[email protected]',
:from => '[email protected]',
:html_body => '<strong>Hello John Doe<strong>',
:track_opens => 'true'
)
end
end
And lastly I'm sending the email via: BusinessMailer.claim_business @business
When I trigger the claim_business
method I see BusinessMailer#claim_business: processed outbound mail in 14.1ms
in my console with no error messages. Can anyone tell me what I'm missing here?
You're missing deliver
method to eventually send the email. Try:
BusinessMailer.claim_business(@business).deliver
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With