So I have this project up on Digital Ocean and it does have an ipv6. As per the Rails Guides, I also set my Gmail account to accept less secure apps to avoid two-step authentication since its just an email being sent to an associate. I've been trying to get an email sent when an update action occurs, but I am receiving an error. Not sure which steps I can take to resolve this
Error Log
I, [2017-12-28T01:21:53.559309 #30437] INFO -- : [99d7e265-eb0a-4bd4-a535-6faab87db03e] Completed 500 Internal Server Error in 30346ms (ActiveRecord: 33.9ms)
F, [2017-12-28T01:21:53.561006 #30437] FATAL -- : [99d7e265-eb0a-4bd4-a535-6faab87db03e]
F, [2017-12-28T01:21:53.561079 #30437] FATAL -- : [99d7e265-eb0a-4bd4-a535-6faab87db03e] Net::OpenTimeout (execution expired):
F, [2017-12-28T01:21:53.561132 #30437] FATAL -- : [99d7e265-eb0a-4bd4-a535-6faab87db03e]
F, [2017-12-28T01:21:53.561177 #30437] FATAL -- : [99d7e265-eb0a-4bd4-a535-6faab87db03e] app/models/listing.rb:55:in `listing_update_notification'
[99d7e265-eb0a-4bd4-a535-6faab87db03e] app/controllers/listings_controller.rb:53:in `block in update'
[99d7e265-eb0a-4bd4-a535-6faab87db03e] app/controllers/listings_controller.rb:47:in `update'
Controller
...
def update
@listing = Listing.find(params[:id])
@listing.attributes = listing_params
respond_to do |format|
if @listing.save
format.html { redirect_to [building, @listing], notice: 'Listing was successfully updated.' }
format.json { render :show, status: :ok, location: @listing }
ListingMailer.listing_email(@listing).deliver_now
elsif params[:listing][:active] == "0" || Listing.find(params[:id]).active ==true
@listing.save(validate: false)
format.html { redirect_to [building, @listing], notice: 'Listing was successfully updated.' }
format.json { render :show, status: :ok, location: @listing }
ListingMailer.listing_email(@listing).deliver_now
else
format.html { render :edit }
format.json { render json: @listing.errors, status: :unprocessable_entity }
end
end
end
production.rb
...
# SMTP Settings for Sending Email
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'example.com',
user_name: ENV['GMAIL_USER'],
password: ENV['GMAIL_PW'],
authentication: 'plain',
enable_starttls_auto: true }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
Listing.rb -- Added Missing model and method
class Listing < ApplicationRecord
...
include ActiveModel::Dirty
after_update :listing_update_notification
...
private
...
def listing_update_notification
ListingMailer.listing_email(self, self.changes).deliver
end
end
Update: I have added the missing model, and have also removed ListingMailer from the controller update action, but am recieving the same error messages in the production logs
Update #2 : I have also spoken with DigitalOcean and had the server changed to have preference with IPv4 and still getting the same errors