RESOLVED: SMTP Time out in Rails app


I have Rails app. I’ve set up a mailer for password resets. I previously was using Mandrill with the same setup (and different host/port/username/password configs). It worked just fine.

I’ve moved over to Hubspot transactional email. Here is my SMTP config:

I have generated a token with this curl command, as per the api docs:

curl -XPOST \
  -H "Content-Type: application/json" \
  -d '{"createdBy":"","campaignName":"Password Reset Email"}' \

I have triple checked that my username/password env vars are the same as the token JSON response.

I keep getting a timeout error and no email delivered:

heroku[router]: at=error
                code=H12 desc="Request timeout"

 INFO -- : Completed 500 Internal Server Error in 60406ms (ActiveRecord: 18.7ms)
FATAL -- : Net::ReadTimeout (Net::ReadTimeout):

Any ideas why it’s timing out?


@veganstraightedge At what point are you getting the timeout? When you are making the curl request you listed above?


I only made the curl request once to get the token initially.

I’m getting the timeout in my server logs after hubspot is contacted but before it ever sends.


@veganstraightedge are you using ?hapikey=demo or your own hapikey? I don’t believe the demo key would work for that.


Where do I find my hapikey?


Here you go!


Ok. Went to there. Generated a real API key. Updated my mail.rb config settings. Tried it ou again. Got this error now.

This is really frustrating. Is there a time where you or a support engineer could screen pair with me and sort this out please? I’m guessing that y’all will be able to get me sorted out real quick like if we do it live. But this slow motion ping pong back and forth isn’t getting me there.



@veganstraightedge I can understand that the ping pong effect can be cumbersome. We are in the process of trying to convert this forum to have the resources to act closer to that of support. However at the moment this forum is not a support forum and we do not offer any type of screen pair/calling/etc.

Can you post the actual error response you are receiving from HubSpot instead of the rails error? If you are not receiving a response from HubSpot and solely a rails error then you might want to try stack overflow as I and my co-workers who help out here are likely not a rails expert. If you are getting any info from the HubSpot servers we would love to see it.


The solution was to change my port from 465 to 587.

Apparently Rails uses SMARTTLS instead of TLS? Not totally sure.

But with 465 requests were just timing out. With 587, it Just Worked™.