Forum: Ruby on Rails Sending email

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
tashfeen.ekram (Guest)
on 2009-04-05 23:59
(Received via mailing list)
I am on ubuntu machine. i want to just do simple testing of sending
emails.

i first tried postfix, then mailtrap (http://rubypond.com/articles/
2007/11/16/trap-rails-from-sending-mail-via-smtp/) to no avail. i keep
getting timed out error.

for postfix my settings were:

config.action_mailer.smtp_settings = {

  :address        => 'localhost',

  :port           => 25,

  :domain         => 'www.example.com'

}

i tried changing to port 2525 to use mailtrap and got the same error.
is there something essential i am missing?

i just want to be able to send emails to test funcinality. not receive
and nothing else. i searched around but i can not
tashfeen.ekram (Guest)
on 2009-04-06 00:01
(Received via mailing list)
sorry message got truncated.

i have looked around but find no solutions...
Schalk N. (Guest)
on 2009-04-06 02:01
(Received via mailing list)
Hi there,

Setting that has always worked for me without fail is:

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

   config.action_mailer.smtp_settings = {
     :address => "mail.yourdomain.com",
     :port => 25,
     :domain => "yourdomain.com"
   }

HTH,
Schalk
tashfeen.ekram (Guest)
on 2009-04-06 04:47
(Received via mailing list)
if i dont own a domain and am just interested in sending emails from
dev environment on my laptop would the config look like this:

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

   config.action_mailer.smtp_settings = {
     :address => "localhost",
     :port => 25
   }
Schalk N. (Guest)
on 2009-04-06 06:15
(Received via mailing list)
I reckon as long as you have a SMTP server running on your local machine
at port 25 you should be good to go.
QJGui (Guest)
on 2009-04-07 08:21
(Received via mailing list)
Most time what's wrong is the smtp server.
You should check the smtp server in your machine. If it works well
when you use other client-email application to connect it, please
check the email settings.
And then, you can set the settings to other server.
Such as gmail.
For gmail, you should know the tls.
Good luck.
tashfeen.ekram (Guest)
on 2009-04-16 23:48
(Received via mailing list)
Do I need to uninstall sendmail before trying to use postfix? (sorry
not exactly a rails question)
James B. (Guest)
on 2009-04-17 00:59
tashfeen.ekram wrote:
> Do I need to uninstall sendmail before trying to use postfix? (sorry
> not exactly a rails question)

No. But you do need to determine which one is running and what ip-addr
and port it is listening on. Sendmail listens on 127.0.0.1:25 by default
so that is where the smtp config should point to.  I have no experience
with Postfix but I imagine that it is similar.  In either case, port 25
is the wks port for smtp traffic.
Marnen L. (Guest)
on 2009-04-17 17:19
tashfeen.ekram wrote:
> Do I need to uninstall sendmail before trying to use postfix? (sorry
> not exactly a rails question)

If setting up an SMTP server on your laptop is too much trouble, you
could always point Rails to your ISP's SMTP server.  This is what I
generally do, at least for development.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
removed_email_address@domain.invalid
tashfeen.ekram (Guest)
on 2009-04-19 04:18
(Received via mailing list)
i just tried to configure to use gmail with the tlsmail gem. i seem to
be getting the same time out error. is there something wrong in my
config. i have tried configuring it to several different inclugin
sendmail and postifx on my laptop, i installed mailtrap plugin, and
now gmail and all give me the same error. really strange....


config for gmail:


require 'tlsmail'

Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)



ActionMailer::Base.raise_delivery_errors = true

ActionMailer::Base.perform_deliveries = true

ActionMailer::Base.delivery_method = :smtp

ActionMailer::Base.smtp_settings = {

    :address => 'smtp.gmail.com',

    :port => 587,

    :tls => true,

    :domain => 'xxxx.com',

    :authentication => :plain,

    :user_name => 'xxxx',

    :password => 'xxxx'

  }

On Apr 17, 9:19 am, Marnen Laibow-Koser <rails-mailing-l...@andreas-
Agustin V. (Guest)
on 2009-04-19 04:23
(Received via mailing list)
require 'smtp_tls'
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
  :address => "smtp.gmail.com",
  :port => "587",
  :domain => "domain.com",
  :authentication => :plain,
  :user_name => "removed_email_address@domain.invalid",
  :password => "password"
}

That is my environment.rb configuration to work with an account with
gmail.

I have my domain to use gmail as the mail service and i don't use the
line:
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)


___________________
      Agustin Viñao
www.agustinvinao.com
 agustinvinao (Skype)
Rick L. (Guest)
on 2009-04-19 04:28
(Received via mailing list)
what version rails?

what's the error message?

I use the following under Rails 2.3.2 - no additional gem.
In the file config/initializers/action_mailer.rb:

-------------------
ActionMailer::Base.delivery_method = :smtp

ActionMailer::Base.smtp_settings = {
   :enable_starttls_auto => true,
   :address => "smtp.gmail.com",
   :port => "587",
   :domain => "engine.local",
   :authentication => :plain,
   :user_name => "bultaco.rick",
   :password => "**********"
 }
-------------------

This works fine for development / testing
This topic is locked and can not be replied to.