Create always a mail method from sample_data

This sets the email config so that mails can be sent right away.
This commit is contained in:
Pau Perez
2018-03-15 20:58:31 +01:00
parent a7f1ed660b
commit 4fc66356cb

View File

@@ -13,10 +13,7 @@ namespace :openfoodnetwork do
country = Spree::Country.find_by_iso(ENV.fetch('DEFAULT_COUNTRY_CODE'))
state = country.states.first
Spree::MailMethod.create!(
environment: Rails.env,
preferred_mails_from: spree_user.email
)
create_mail_method
# -- Shipping / payment information
unless Spree::Zone.find_by_name 'Australia'
@@ -211,5 +208,23 @@ namespace :openfoodnetwork do
spree_user.confirm!
end
def create_mail_method
Spree::MailMethod.destroy_all
CreateMailMethod.new(
environment: Rails.env,
preferred_enable_mail_delivery: true,
preferred_mail_host: ENV['MAIL_HOST'],
preferred_mail_domain: ENV['DOMAIN'],
preferred_mail_port: ENV['MAIL_PORT'],
preferred_mail_auth_type: "login",
preferred_smtp_username: ENV['SMTP_USERNAME'],
preferred_smtp_password: ENV['SMTP_PASSWORD'],
preferred_secure_connection_type: "None",
preferred_mails_from: "no-reply@#{ENV['DOMAIN']}",
preferred_mail_bcc: "",
preferred_intercept_email: ""
).call
end
end
end