map7
map7

Reputation: 5126

RefineryCMS inquiries not sending email

I'm working with an old RefineryCMS 1.0.8 project and migrating it to another server. It all works apart from the contact us form.

Here is my setup in the production.rb file

# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify

config.action_mailer.delivery_method = :sendmail
# Defaults to:
# config.action_mailer.sendmail_settings = {
#   location: '/usr/sbin/sendmail',
#   arguments: '-i -t'
# }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

if ENV['MAILER_USERNAME'].present? && ENV['MAILER_PASSWORD'].present?
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    address: "smtp.gmail.com",
    port: 587,
    domain:  "my_domain.com.au",
    user_name: "#{ENV['MAILER_USERNAME']}",
    password: "#{ENV['MAILER_PASSWORD']}",
    authentication: 'plain',
    enable_starttls_auto: true
  }
end

I've set the environment variables in my /etc/environment and /etc/apache2/envvars files like so;

export MAILER_USERNAME="<email address>"
export MAILER_PASSWORD="<password>"

I've also set the tld to a length of 2 as we are in Australia so we are using a .com.au. This is set in my config/application.rb

config.action_dispatch.tld_length = 2

Here is the error I get;

Sent mail to <my gmail address> (2924ms)
There was an error delivering an inquiry confirmation:
555 5.5.2 Syntax error. w20sm33182626pfi.31 - gsmtp

Upvotes: 0

Views: 72

Answers (2)

map7
map7

Reputation: 5126

I found the problem was not the brackets around the email it was the fact that I hadn't setup the DNS to that machine yet. Once I did that last night and went to the refinerycms website at it's domain instead of the IP then I could send emails.

Upvotes: 0

Hass
Hass

Reputation: 1636

You should wrap your email in <> blocks.

export MAILER_USERNAME="<[email protected]>"
export MAILER_PASSWORD="password"

Upvotes: 0

Related Questions