Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mandrill send e-mail from localhost

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 => "[email protected]"
  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.

like image 352
Laurent Avatar asked Jun 03 '26 09:06

Laurent


1 Answers

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

like image 116
Kaitlin Avatar answered Jun 06 '26 01:06

Kaitlin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!