Added postmaster@ and abuse@ to virtuals when you create a domain. Hard coded at the moment.

This commit is contained in:
2024-05-09 12:01:45 +01:00
parent e3d0e72a38
commit 1ac47de706
6 changed files with 107 additions and 93 deletions

View File

@@ -1,6 +1,14 @@
class Domain < ApplicationRecord
after_create :create_abuse_postmaster
has_many :credentials, dependent: :destroy
has_many :virtuals, dependent: :destroy
validates :domain, presence: true
validates :domain, uniqueness: true
private
def create_abuse_postmaster
Virtual.create(email: "abuse@#{self.domain}", destination: "jez@warwickhunt.com", domain_id: self.id)
Virtual.create(email: "postmaster@#{self.domain}", destination: "jez@warwickhunt.com", domain_id: self.id)
end
end