Question

I'm using Mandrill to build a feedback form for users on the website (they fill the form and send me an e-mail).

I want to test the e-mail functionality in development. I use unicorn as a server and my local address is 0.0.0:8080

However I get a 500 server error, Net::SMTPServerBusy : Relay Access Denied

I followed the Heroku instructions step by step.

Here is m application.rb configuration:

config.action_mailer.smtp_settings = {
      :address => 'smtp.mandrillapp.com',
      :port => '587',
      :domain => 'heroku.com',
      :user_name => ENV['MANDRILL_USERNAME'],
      :password => ENV['MANDRILL_APIKEY']
    }

    ActionMailer::Base.delivery_method = :smtp

I followed the instructions on mandrill/heroku web page to set up.

I have a .env file set up with a MANDRILL_USERNAME and my MANDRILL_APIKEY

Here is my ActionMailer file:

class FeedbackMailer < ActionMailer::Base
  default :from => ""
  default :to => "xxx@stanford.edu"
  default :subject => "feedback about xxx"

  def send_feedback(message)
    #debugger
    @message = message
    mail(:from => message[:sender_email])

  end
end

Any help would be appreciated.

I can confirm e-mails get sent in production.

Was it helpful?

Solution

If all of your settings are working in production but not locally, there are a couple of possibilities:

  1. How are you loading the variables from .env to ENV? It's possible the environment variables aren't getting loaded as expected locally. If you hard code the credentials locally, does it work?

  2. You could be running in to an issue with the port or outbound SMTP traffic being blocked. Consider trying port 2525, as it may be less likely to be blocked by local ISPs. Port 465 with SSL enabled may also work even if your ISP is blocking other SMTP traffic

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top