Sending email

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

sorry message got truncated.

i have looked around but find no solutions...

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 wrote:

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    }

I reckon as long as you have a SMTP server running on your local machine

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.

Do I need to uninstall sendmail before trying to use postfix? (sorry not exactly a rails question)

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,

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'

  }

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](http://smtp.gmail.com)",
  :port => "587",
  :domain => "[domain.com](http://domain.com)",
  :authentication => :plain,

  :user_name => "mail@domain.com",
  :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)

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: