Rails 3.2: Devise: Email Name - email

I have a Rails 3.2 application which uses Devise for authentication.
I would like the confirmation email for signups to have "Foo Signups" as the from: email name and "signups#foo.com" as the email address. Right now, I just have "signups#foo.com" as the from: email address.
My config looks like this:
# in the file config/initializers/devise.rb
Devise.setup do |config|
config.mailer_sender="signups#foo.com"
# etc...
and
# in the file config/environments/development.rb
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_ADDRESS"],
password: ENV["GMAIL_PASSWORD"]
}
where GMAIL_ADDRESS and GMAIL_PASSWORD are my Gmail user and password as environment variables and different from signups#foo.com.
How do I configure SMTP or Devise to make "Foo Signups" as the email name and "signups#foo.com" as the email address?

With ActionMailer you can set your from email address similar to "#{#user.name} <#{#user.email}>"
I have not tried this in Devise, but I would think the same thought process would work for the config since I am sure it is just sending that info along to ActionMailer:
Devise.setup do |config|
config.mailer_sender= "Foo Signups <signups#foo.com>"
#...
end

Related

Gitlab not sending email

I've installed gitlab ce on docker with the documentation, everything is ok but mails doesn't works in gitlab (ask for new password for example).
When I test my conf in the rail-console I get the mail, when gitlab is supposed to send email, it doesn't works.
For mail I use OVH SMTP conf, my smtp_settings.yml is ok
see by yourself :
# This file is managed by gitlab-ctl. Manual changes will be
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb
# and run `sudo gitlab-ctl reconfigure`.
if Rails.env.production?
Gitlab::Application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
authentication: :login,
address: "ssl0.ovh.net",
port: 465,
user_name: "myemail#domain.dn",
password: "mypassword",
domain: "ssl0.ovh.net",
enable_starttls_auto: true,
tls: true,
openssl_verify_mode: "peer",
ca_file: "/opt/gitlab/embedded/ssl/certs/cacert.pem",
}
end
I already tried openssl_verify_mode: "peer" and "none"
Any idea ? I'm on it from about a month.

Gitlab setup not sending email

I am trying to setup GitLab in windows azure. I followed this blog Setup GitLab in azure and it is working as charm. But I could not configure smtp mail sending through GitLab.
I have followed this settings SMTP Setup. Tried both Gmail and Zoho, with both ports 465 and 587
I am getting the following error
2016-09-21_09:44:28.55626 2016-09-21T09:44:28.556Z 13562 TID-vskyw WARN: {"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"ActionMailer::DeliveryJob","queue":"mailers","args":[{"job_class":"ActionMailer::DeliveryJob","job_id":"6a954ac7-19d6-4b27-b28c-c511f25e6896","queue_name":"mailers","arguments":["DeviseMailer","confirmation_instructions","deliver_now",{"_aj_globalid":"gid://gitlab/User/1"},"tgShkQTx5e1sALoxkkGi",{"to":"<my email here>","_aj_symbol_keys":["to"]}],"locale":"en"}],"retry":true,"jid":"cbd7dc87ce4202265d1a6be7","created_at":1474450319.7324607,"enqueued_at":1474451065.2083879,"error_message":"end of file reached","error_class":"EOFError","failed_at":1474450320.9358478,"retry_count":5,"retried_at":1474451068.5555682}
2016-09-21_09:44:28.55639 2016-09-21T09:44:28.556Z 13562 TID-vskyw WARN: EOFError: end of file reached
I tried various combinations for SSL and TLS, but no luck yet!
I am using GitLab 8.11.7
Any help would be appreciated.
UPDATE:
I tried with GMail smtp and it works fine after allowing access to apps using this URL. This issue might be due to some Zoho's smtp policy
You should use the new smtp configurations
If you're installing from source and use SMTP to deliver mail, you will need to add the following line to config/initializers/smtp_settings.rb:
ActionMailer::Base.delivery_method = :smtp
As seen in https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/8.10-to-8.11.md#smtp-configuration
A configuration exemple for smtp_settings.rb is:
if Rails.env.production?
Rails.application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: "email.server.com",
port: 465,
user_name: "smtp",
password: "123456",
domain: "gitlab.company.com",
authentication: :login,
enable_starttls_auto: true,
openssl_verify_mode: 'peer' # See ActionMailer documentation for other possible options
}
end
You can see the sample file doc for configuring SMTP at https://gitlab.com/gitlab-org/gitlab-ce/blob/8-12-stable/config/initializers/smtp_settings.rb.sample#L13?
You can see more configuration options here http://api.rubyonrails.org/classes/ActionMailer/Base.html#class-ActionMailer::Base-label-Configuration+options

FOSUserBundle not sending registration email

I have found a few topics related to the same issues, but the solution for them was a miss-configuration of the smtp settings.
I am using symfony 3.0 and latest FOSUserBundle. My config settings are:
fos_user:
db_driver: orm
firewall_name: main
user_class: AppBundle\Entity\User
resetting:
email:
template: email/password_resetting.email.twig
registration:
form:
type: AppBundle\Form\RegistrationType
confirmation:
enabled: true
from_email:
address: registration#site.com
sender_name: 'Our Team'
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
port: "%mailer_port%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
I am able to send other emails from the same project, using the same swiftmailer settings.
I have checked the web developer tool and the email is prepared for sending
Web profiler - email area
The registration email is not received in the inbox or spam folders.
Could you let me know if I have missed anything in the configuration files that prevents the registration email from being sent?
Thanks,
Lucia
I found a solution for my problem. The registration email address had to be the same as the one used for the swiftmailer username settings. Having it set to a different email address did not work for me.

devise forgot password email not sending

Im trying to send a forgot password email. However the following error occurs -
Net::SMTPAuthenticationError in Devise::PasswordsController#create
535-5.7.8 Username and Password not accepted. Learn more at
I manage to see the sent email within the logs file but not within my actual inbox. Any ideas on how to fix this error?
Heres my development.rb code -
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "gmail.com",
authentication: "plain",
enable_starttls_auto: true,
user_name: "myemail#gmail.com",
password: "mypassword"
}
Using: rails 4 and devise 3.2.3
Thanks
This error usually occurs when the associated email address is setup for 2-factor authentication. If you want to test with the same gmail account then generate an Application specific password. See details here.
If you have a another gmail account which does not require 2-factor authentication then try that one instead in your code.

symfony2 + fos user bundle, register confirmation mail not receiving

I installed FOS UserBundle for user login/register. The thing is that after registering, it redirects me on the "../register/check-email" page where it has the well-known message that a mail with the activation link has been sent to the user's email, but I don't receive any e-mail.
My config.yml file has this code for the fos_user:
fos_user:
db_driver: orm
firewall_name: main
user_class: IngrijireMedicalaAcasa\AppBundle\Entity\User
registration:
form:
type: ingrijiremedicalaacasa_appbundle_registration
confirmation:
enabled: true
service:
mailer: fos_user.mailer.default
from_email:
address: noreply#anytext.com
sender_name: any text
Do I have to do any other configuration somewhere?
I mention I tried to change the address "noreply#anytext.com" with my own valid mail address.
I changed even the parameters.yml with my mail details but it still doesn't work.
Oh, and I try to send the mail from my localhost.
I hope you guys know what's the solving to my problem. I think it's a small thing that I don't see, I don't know or I forgot to do it.
try this : (works if your email is gmail (mailer_transport)
#app/config/config.yml
//
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
# host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: IngrijireMedicalaAcasa\AppBundle\Entity\User
registration:
confirmation:
from_email:
address: your.email#gmail.com
sender_name: Any Text
enabled: true
service:
mailer: fos_user.mailer.twig_swift
in your config_dev.yml :
//
assetic:
use_controller: true
swiftmailer:
transport: gmail
username: your.email#gmail.com
password: your password
in app/config/parameter.yml:
//
mailer_transport: gmail
//