Swap out contact form to one that uses mailgun

This commit is contained in:
rebuilt 2022-11-01 15:51:16 -07:00
parent 6df92d6f88
commit 7f433cf223
17 changed files with 130 additions and 70 deletions

17
app/models/contact.rb Normal file
View file

@ -0,0 +1,17 @@
class Contact < MailForm::Base
attribute :name, validate: true
attribute :email, validate: /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
attribute :organization
attribute :message
attribute :nickname, captcha: true
# Declare the e-mail headers. It accepts anything the mail method
# in ActionMailer accepts.
def headers
{
:subject => "Contact Form Inquiry",
:to => ENV['CONTACT_FORM_DESTINATION'] || "memoryman51@hotmail.com",
:from => %("#{name}" <#{email}>)
}
end
end