John Oggy
John Oggy

Reputation: 319

How to send email using SMTP server?

mailers/development.rb

config.action_mailer.delivery_method = :smtp  
config.action_mailer.smtp_settings = {
 :adress => '[email protected]',
 :port => 25,
 :authentication => :login,
 :user_name => 'myemail',
 :password => 'secret'
}   

Here is my Mailer:

class UserMailer < ActionMailer::Base
def welcome_email(name, email, subject, question)
@recipients   = email
@from         = "[email protected]"
headers         "Reply-to" => "[email protected]"
@subject      = "Welcome to MyDomain"
@sent_on      = Time.now
@content_type = "text/html"
#body[:username]  = name
mail(:to => email, :subject => subject, :from => '[email protected]')
end
end

Have this error: 504 5.3.3 AUTH mechanism LOGIN not available

Please help, Thanks in advance.

Upvotes: 0

Views: 1326

Answers (1)

Ian Kenney
Ian Kenney

Reputation: 6426

I use something along these lines to talk with gmail

config.action_mailer.delivery_method = :smtp  
config.action_mailer.perform_deliveries = true

config.action_mailer.smtp_settings = {
 :address => 'smtp.gmail.com',
 :port => 587,
 :authentication => 'plain',
 :user_name => 'myemail',
 :password => 'secret',
 :enable_starttls_auto => true,
 :domain => 'gmail.com'
}   

Upvotes: 1

Related Questions