I created my mail contact formular with this post: link
In the post regards to gmail. I'm from Germany, I could only use googlemail.com instead. So I changed everything from gmail to googlemail. I get no errormessages but no mails are received in the googlemail account.
This is my mailing config:
# Mail config
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.googlemail.com",
:port => 587,
:user_name => 'khsuite#googlemail.com',
:password => 'mypassword',
:authentication => 'plain',
:enable_starttls_auto => true }
Are there any other settings necessary for googlemail?
Related
I would like to use Sendinblue to send transactional email from my Ruby on Rails web application via SMTP.
I edited config/environments/production.rb as follows:
ActionMailer::Base.smtp_settings = {
:address => 'smtp-relay.sendinblue.com',
:port => '587',
:authentication => :plain,
:user_name => ???,
:password => ???,
:domain => 'fireworks.com',
:enable_starttls_auto => true
}
What am I expected to use as user_name and password? My account's username and password or my SMTP keys? Also, am I required to use any gem, like sib-api-v3-sdk, or this gem is useful only for sending email using the Sendinblue API?
This is all you need to use SendInBlue with ActionMailer. Other answers suggest to use gems that are not required for SMTP. You DO NOT need the sendinblue or sib-api-v3-sdk gems to use SIB with ActionMailer in a plain vanilla Rails app.
#config/environments/production.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => ENV.fetch('SMTP_HOST', 'smtp-relay.sendinblue.com'),
:port => ENV.fetch('SMTP_PORT', '587'),
:authentication => :plain,
:user_name => ENV['SMTP_USERNAME'], #See: https://account.sendinblue.com/advanced/api
:password => ENV['SMTP_PASSWORD'], #See: https://account.sendinblue.com/advanced/api
:enable_starttls_auto => true
}
Add this to your gemfile
gem 'sib-api-v3-sdk'
Add this to config/environments/production.rb
config.action_mailer.default_url_options = { host: "your_domain.com", port: 587 }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp-relay.sendinblue.com",
:port => 587,
:user_name => ENV['SEND_IN_BLUE_USERNAME'],
:password => ENV['SEND_IN_BLUE_PASSWORD'],
:authentication => 'login',
:enable_starttls_auto => true
}
Add this in in config/initializers/send_in_blue.rb
SibApiV3Sdk.configure do |config|
config.api_key['api-key'] = ENV["SEND_IN_BLUE_API_KEY"]
end
Make sure your environment variables are correct. It works for me in production.
can add gem 'sendinblue'Official Sendinblue provided API V2 Ruby GEM
In order to send an email, you need to change the smtp settings in config/environments/*.rb(Whichever applicable)
Rails.application.configure do
#append this settings
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => ‘smtp-relay.sendinblue.com’,
:port => 587,
:user_name => ‘YOUR_SENDINBLUE_EMAIL’,
:password => ‘YOUR_SENDINBLUE_PASSWORD’,
:authentication => ‘login’,
:enable_starttls_auto => true
}
end
change STMP & API in Your setting account
STMP SERVER --> smtp-relay.sendinblue.com
port --> 587
I use devise and this error occurs when devise try to send email to confirm user's email.
Follow below my development.rb which
development.rb
# Email
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host: 'domain.com' }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.asset_host = 'badoda.com'
config.action_mailer.smtp_settings = {
:address => 'outlook.office365.com',
:port => 587,
:user_name => 'it#domain.com',
:password => 'password',
:domain => 'domain.com',
:authentication => :login,
:enable_starttls_auto => true
}
It seems to be an issue with Office 365 SMTP relay configuration. Please follow the steps here to configure SMTP properly.
Does your MIME message specify the right Sender header?
My question is very similar to this one but the accepted answer has not solved my problem.
Here is what I have for my config file:
# Config for mailserver
config.active_support.deprecation = :notify
config.action_mailer.delivery_method = :smtp
# SMTP settings for Exchange server
config.action_mailer.smtp_settings = {
:address => 'outlook.<domain>',
:port => 25,
:authentication => :ntlm,
:user_name => '<userName>#<domain>',
:password => '<unencryptedPassword',
:domain => '<domain>',
:enable_starttls_auto => true
}
I have tried setting up a relay connector on the Exchange server to accept requests from the IP address of my application.
Also, my original problem was before I used NTLM and my config file looked like so but I got the same error:
# Config for mailserver
config.active_support.deprecation = :notify
config.action_mailer.delivery_method = :smtp
# SMTP settings for Exchange server
config.action_mailer.smtp_settings = {
:address => 'outlook.<domain>',
:port => 25,
:authentication => :login,
:user_name => '<userName>#<domain>',
:password => '<unencryptedPassword',
:domain => '<domain>',
:enable_starttls_auto => true
}
I have successfully been able to send email using Gmail's SMTP server so I don't think it's the Rails side, but the Exchange server not recognizing my application.
Turns out I was using the wrong authentication because the Exchange server doesn't require any sort of authentication (mainly so printers, faxes, etc. don't need to authenticate).
Here's the resulting settings I used:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'outlook.<domain>',
:port => 25,
:authentication => :plain,
:enable_starttls_auto => true
}
I tried to configure actionmailer to send via google apps with smtp.
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "mydomain.com",
:user_name => "username",
:password => "password",
:authentication => 'plain',
:enable_starttls_auto => true }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
However whenever gitlab tries to send an e-mail:
Sent mail to user#my.domain.com (10ms)
Completed 500 Internal Server Error in 29ms
535-5.7.1 Username and Password not accepted
Server runs ruby 1.9.3p194. Why doesn't google apps accept the username/password?
It works now, I think the problem was with the username. it needs the domain in the username. i.e. the problem was
user_name: 'username'
Whereas the correct way (at least for google apps) is
user_name : 'username#mydomain.com'
this works for me:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:user_name => "you#gmail.com",
:password => "password",
:authentication => 'plain',
:enable_starttls_auto => true }
Try setting the domain to gmail.com
I'm using sendgrid on heroku to send email in production, but would like to send email locally on my mac.
I've configured my development.rb a million different ways and keep getting
"Net::SMTPFatalError: 550 Cannot receive from specified address : Unauthenticated senders not allowed"
Spefically, I tried
varying authentication b/w :plain and :login,
tried using my gmail account credentials,
tried using my google app account credentials.
Nothing seems to work, thoughts?
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
ActionMailer::Base.smtp_settings = {
:address => 'smtp.gmail.com',
:domain => 'somedomain.com',
:port => 587,
:user_name => 'username#somedomain.com',
:password => 'somepassword',
:authentication => :plain,
:enable_starttls_auto => true
}
I thought I had set the in the production settings (production.rb), it turns out I had set them in environment.rb. Removed it there and everything started working.
I had set the mail settings by accident in the Environment.rb so it was overriding anything I was doing at the production/development config level.
Could you try this?
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:user_name => "email#gmail.com",
:password => "password",
:authentication => "plain",
:enable_starttls_auto => true
}