From a Rails application containing email addresses I want to send emails.
Therefore I am testing sending emails.
It does not work though I have read a lot about how to do it. I guess my
.../config/initializers/mail.rb is wrong.
I have based the settings on the answers here but I do not understand them
fully.
File content:
ActionMailer::Base.smtp_settings = {
address: "smtp.x.y",
port: 465,
domain: "x.y"
user_name: "me",
password: "my",
authentication: :login,
enable_starttls_auto: true
}
This is based on my settings in Thunderbird for outgoing server:
Server Name smtp.x.y
Port 465
User name me
Authentication method Normal password
Connection Security SSL/TLS
The error is reported as
Completed 500 Internal Server Error in 60254ms
Timeout::Error (Timeout::Error):
app/controllers/mail_messages_controller.rb:56:in `block in create''
app/controllers/mail_messages_controller.rb:54:in `create''
OS Ubuntu 12.04
Ruby 1.9.3
Rails 3.2.9
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/Y5OXykIe6HsJ.
For more options, visit https://groups.google.com/groups/opt_out.
jleake-xLhkCMTzzpz10XsdtD+oqA@public.gmane.org
2013-Mar-24 12:43 UTC
Re: Help to send email required
mailers/user_mailer.rb
class UserMailer < ActionMailer::Base
default from: "youremailaddress"
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.user_mailer.password_reset.subject
#
def password_reset(user)
@user = user
mail :to => user.email, :subject => "Password Reset"
end
end
config/environment/development.rb
# Expands the lines which load the assets
config.assets.debug = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.default_url_options = { :host =>
"localhost:3001" }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:tls => true,
:openssl_verify_mode => OpenSSL::SSL::VERIFY_NONE,
#FAIL_IF_NO_PEER_CERT,
:address => "youremailserver.com",
:domain => "yourwebsite",
:port => 465,
:name => ''youremailaddress'',
:password => ''accountpassword'',
:authentication => :login,
:enable_starttls_auto => false }
Lubuntu 12.0.4
Ruby 1.9.3
Rails 3.2.11
Thunderbird
Works for me.
On Sunday, 24 March 2013 09:11:15 UTC, Tommy Pollák
wrote:>
> From a Rails application containing email addresses I want to send emails.
> Therefore I am testing sending emails.
>
> It does not work though I have read a lot about how to do it. I guess my
> .../config/initializers/mail.rb is wrong.
>
> I have based the settings on the answers here but I do not understand them
> fully.
>
> File content:
>
> ActionMailer::Base.smtp_settings = {
> address: "smtp.x.y",
> port: 465,
> domain: "x.y"
> user_name: "me",
> password: "my",
> authentication: :login,
> enable_starttls_auto: true
> }
>
> This is based on my settings in Thunderbird for outgoing server:
>
> Server Name smtp.x.y
> Port 465
> User name me
> Authentication method Normal password
> Connection Security SSL/TLS
>
> The error is reported as
>
> Completed 500 Internal Server Error in 60254ms
>
> Timeout::Error (Timeout::Error):
> app/controllers/mail_messages_controller.rb:56:in `block in
create''
> app/controllers/mail_messages_controller.rb:54:in `create''
>
>
> OS Ubuntu 12.04
> Ruby 1.9.3
> Rails 3.2.9
>
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/KYSYu8-YSy8J.
For more options, visit https://groups.google.com/groups/opt_out.
Hmmm, You really repeat one of the points that make confused - :domain => "yourwebsite", I am running on my client, localhost, and do not have any own web address, so what should domain be set to? On Sunday, 24 March 2013 13:43:41 UTC+1, jle...-xLhkCMTzzpz10XsdtD+oqA@public.gmane.org wrote:> > mailers/user_mailer.rb > class UserMailer < ActionMailer::Base > default from: "youremailaddress" > > # Subject can be set in your I18n file at config/locales/en.yml > # with the following lookup: > # > # en.user_mailer.password_reset.subject > # > def password_reset(user) > @user = user > mail :to => user.email, :subject => "Password Reset" > end > end > > config/environment/development.rb > # Expands the lines which load the assets > config.assets.debug = true > config.action_mailer.raise_delivery_errors = true > config.action_mailer.perform_deliveries = true > config.action_mailer.default_url_options = { :host => "localhost:3001" } > config.action_mailer.delivery_method = :smtp > config.action_mailer.smtp_settings = { > :tls => true, > :openssl_verify_mode => OpenSSL::SSL::VERIFY_NONE, > #FAIL_IF_NO_PEER_CERT, > :address => "youremailserver.com", > :domain => "yourwebsite", > :port => 465, > :name => ''youremailaddress'', > :password => ''accountpassword'', > :authentication => :login, > :enable_starttls_auto => false } > > Lubuntu 12.0.4 > Ruby 1.9.3 > Rails 3.2.11 > Thunderbird > > Works for me. > > On Sunday, 24 March 2013 09:11:15 UTC, Tommy Pollák wrote: >> >> From a Rails application containing email addresses I want to send >> emails. Therefore I am testing sending emails. >> >> It does not work though I have read a lot about how to do it. I guess my >> .../config/initializers/mail.rb is wrong. >> >> I have based the settings on the answers here but I do not understand >> them fully. >> >> File content: >> >> ActionMailer::Base.smtp_settings = { >> address: "smtp.x.y", >> port: 465, >> domain: "x.y" >> user_name: "me", >> password: "my", >> authentication: :login, >> enable_starttls_auto: true >> } >> >> This is based on my settings in Thunderbird for outgoing server: >> >> Server Name smtp.x.y >> Port 465 >> User name me >> Authentication method Normal password >> Connection Security SSL/TLS >> >> The error is reported as >> >> Completed 500 Internal Server Error in 60254ms >> >> Timeout::Error (Timeout::Error): >> app/controllers/mail_messages_controller.rb:56:in `block in create'' >> app/controllers/mail_messages_controller.rb:54:in `create'' >> >> >> OS Ubuntu 12.04 >> Ruby 1.9.3 >> Rails 3.2.9 >> >>-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/JGap7a95JEIJ. For more options, visit https://groups.google.com/groups/opt_out.
jleake-xLhkCMTzzpz10XsdtD+oqA@public.gmane.org
2013-Mar-24 14:50 UTC
Re: Help to send email required
Hi, Sorry I do not know. This also confused me. Try using a name associated with your email service provider. It should not have anything to do with where your app server is running from. John On Sunday, 24 March 2013 09:11:15 UTC, Tommy Pollák wrote:> > From a Rails application containing email addresses I want to send emails. > Therefore I am testing sending emails. > > It does not work though I have read a lot about how to do it. I guess my > .../config/initializers/mail.rb is wrong. > > I have based the settings on the answers here but I do not understand them > fully. > > File content: > > ActionMailer::Base.smtp_settings = { > address: "smtp.x.y", > port: 465, > domain: "x.y" > user_name: "me", > password: "my", > authentication: :login, > enable_starttls_auto: true > } > > This is based on my settings in Thunderbird for outgoing server: > > Server Name smtp.x.y > Port 465 > User name me > Authentication method Normal password > Connection Security SSL/TLS > > The error is reported as > > Completed 500 Internal Server Error in 60254ms > > Timeout::Error (Timeout::Error): > app/controllers/mail_messages_controller.rb:56:in `block in create'' > app/controllers/mail_messages_controller.rb:54:in `create'' > > > OS Ubuntu 12.04 > Ruby 1.9.3 > Rails 3.2.9 > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/GWCqU2zFe_4J. For more options, visit https://groups.google.com/groups/opt_out.
I tried to set up a different mail account I have. The response was different "Connection refused - connect(2)". This is OK, I believe, because my ISP does not allow mail relay. So obviously I get in touch with my ISP but am unable to login. Any hints? On Sunday, 24 March 2013 15:50:15 UTC+1, jle...-xLhkCMTzzpz10XsdtD+oqA@public.gmane.org wrote:> > Hi, Sorry I do not know. This also confused me. Try using a name > associated with your email service provider. It should not have anything > to do with where your app server is running from. > > John > > On Sunday, 24 March 2013 09:11:15 UTC, Tommy Pollák wrote: >> >> From a Rails application containing email addresses I want to send >> emails. Therefore I am testing sending emails. >> >> It does not work though I have read a lot about how to do it. I guess my >> .../config/initializers/mail.rb is wrong. >> >> I have based the settings on the answers here but I do not understand >> them fully. >> >> File content: >> >> ActionMailer::Base.smtp_settings = { >> address: "smtp.x.y", >> port: 465, >> domain: "x.y" >> user_name: "me", >> password: "my", >> authentication: :login, >> enable_starttls_auto: true >> } >> >> This is based on my settings in Thunderbird for outgoing server: >> >> Server Name smtp.x.y >> Port 465 >> User name me >> Authentication method Normal password >> Connection Security SSL/TLS >> >> The error is reported as >> >> Completed 500 Internal Server Error in 60254ms >> >> Timeout::Error (Timeout::Error): >> app/controllers/mail_messages_controller.rb:56:in `block in create'' >> app/controllers/mail_messages_controller.rb:54:in `create'' >> >> >> OS Ubuntu 12.04 >> Ruby 1.9.3 >> Rails 3.2.9 >> >>-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/v-TDPTvVG-wJ. For more options, visit https://groups.google.com/groups/opt_out.
Problem solved!
Careful inspection of the Thunderbird outgoing server settings revealed
that my mailer smtp.x.y
required the following settings in .../config/initializers/mail.rb:
ActionMailer::Base.smtp_settings = {
...
:enable_starttls_auto => false,
:ssl => true
}
Once this was corrected I got the report that the from field in the mail
had to contain an existing domain.
domain in the smtp_settings is set to x.y where x.y is taken from address
=> smtp.x.y but I do not know if this of any importance.
Thanks for all hints.
On Sunday, 24 March 2013 16:49:26 UTC+1, Tommy Pollák
wrote:>
> I tried to set up a different mail account I have. The response was
> different "Connection refused - connect(2)". This is OK, I
believe, because
> my ISP does not allow mail relay.
>
> So obviously I get in touch with my ISP but am unable to login. Any hints?
>
> On Sunday, 24 March 2013 15:50:15 UTC+1,
jle...-xLhkCMTzzpz10XsdtD+oqA@public.gmane.org wrote:
>>
>> Hi, Sorry I do not know. This also confused me. Try using a name
>> associated with your email service provider. It should not have
anything
>> to do with where your app server is running from.
>>
>> John
>>
>> On Sunday, 24 March 2013 09:11:15 UTC, Tommy Pollák wrote:
>>>
>>> From a Rails application containing email addresses I want to send
>>> emails. Therefore I am testing sending emails.
>>>
>>> It does not work though I have read a lot about how to do it. I
guess my
>>> .../config/initializers/mail.rb is wrong.
>>>
>>> I have based the settings on the answers here but I do not
understand
>>> them fully.
>>>
>>> File content:
>>>
>>> ActionMailer::Base.smtp_settings = {
>>> address: "smtp.x.y",
>>> port: 465,
>>> domain: "x.y"
>>> user_name: "me",
>>> password: "my",
>>> authentication: :login,
>>> enable_starttls_auto: true
>>> }
>>>
>>> This is based on my settings in Thunderbird for outgoing server:
>>>
>>> Server Name smtp.x.y
>>> Port 465
>>> User name me
>>> Authentication method Normal password
>>> Connection Security SSL/TLS
>>>
>>> The error is reported as
>>>
>>> Completed 500 Internal Server Error in 60254ms
>>>
>>> Timeout::Error (Timeout::Error):
>>> app/controllers/mail_messages_controller.rb:56:in `block in
create''
>>> app/controllers/mail_messages_controller.rb:54:in
`create''
>>>
>>>
>>> OS Ubuntu 12.04
>>> Ruby 1.9.3
>>> Rails 3.2.9
>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/BZaioKfD6IIJ.
For more options, visit https://groups.google.com/groups/opt_out.