def valid?
valid = true
valid &= complain("Attribute 'to_email' must be specified", self) unless arg(:to_email)
valid &= complain("Attribute 'delivery_method' must be one of [ :smtp | :sendmail ]", self) unless [:smtp, :sendmail].include?(arg(:delivery_method))
if arg(:delivery_method) == :smtp
valid &= complain("Attribute 'server_host' must be specified", self) unless arg(:server_host)
valid &= complain("Attribute 'server_port' must be specified", self) unless arg(:server_port)
if arg(:server_auth)
valid &= complain("Attribute 'server_domain' must be specified", self) unless arg(:server_domain)
valid &= complain("Attribute 'server_user' must be specified", self) unless arg(:server_user)
valid &= complain("Attribute 'server_password' must be specified", self) unless arg(:server_password)
end
end
valid
end