2

I can't seem to be able to achieve this. I saw this asked before here, but I can't get it to work. I want to send mail from my dreamhost mail, set up like this:

require 'mail'
options = { :address              => "smtp.dreamhost.com",
            :port                 => 465,
            :domain               => 'mydomain.cl',
            :user_name            => 'me@mydomain.cl',
            :password             => 'pass',
            :authentication       => 'plain',
            :enable_starttls_auto => true  }

Mail.defaults do
  delivery_method :smtp, options
end

Mail.deliver do
              from     'me@mydomain.cl'
              to       'mypersonalemail@gmail.com'
              subject  'test'
              body     'test'
              add_file 'test.txt'
end

Apparently the authentication is working, but after several seconds all I get is the following error:

Net::ReadTimeout with #<TCPSocket:(closed)>

Does anybody have a clue on what may be going on?

Thank you.

Valentin Mars
  • 91
  • 2
  • 6
  • well is your username me@mydomain.cl ? gotta change it to your email – Polydynamical Sep 05 '20 at 21:08
  • Yes it is, I use it this way to send smtp emails from my gmail using "send mail as" and it works fine. – Valentin Mars Sep 05 '20 at 21:53
  • ah i think i see the problem. which type of mail does your dreamhost email use? i.e. gmail, yahoo, etc. – Polydynamical Sep 05 '20 at 21:54
  • @cbracketdash Dreamhost has its own webmail. Webmail.dreamhost.com. – Valentin Mars Sep 05 '20 at 22:08
  • I'd try switching the config out for a g-mail account and seeing if the issue is with the e-mail host you're trying to use or something within your application – Mark Sep 05 '20 at 22:09
  • @Mark actually it works when I use Gmail, but with the dreamhost mail config. – Valentin Mars Sep 05 '20 at 22:19
  • yeah the reason why we're asking is because difference domains use different ports to send emails. – Polydynamical Sep 05 '20 at 22:35
  • @cbracketdash yes, but in the SMTP config I use on my gmail, to send emails through my dreamhost mail, I use port 465. It's also the port listed in dreamhost documentation. Oh, and in my last comment, I meant it works when I use my gmail, but NOT with the dreamhost mail config. – Valentin Mars Sep 05 '20 at 22:48

0 Answers0