2014-06-03 18:27:20 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
type SMTP struct {
|
|
|
|
SMTPId int64 `json:"-"`
|
|
|
|
CampaignId int64 `json:"-"`
|
2014-06-05 04:54:46 +00:00
|
|
|
Host string `json:"host"`
|
2014-06-03 18:27:20 +00:00
|
|
|
Username string `json:"username,omitempty"`
|
|
|
|
Password string `json:"password,omitempty" sql:"-"`
|
|
|
|
FromAddress string `json:"from_address"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *SMTP) Validate() (string, bool) {
|
|
|
|
switch {
|
|
|
|
case s.FromAddress == "":
|
|
|
|
return "No from address specified", false
|
2014-06-05 04:54:46 +00:00
|
|
|
case s.Host == "":
|
2014-06-03 18:27:20 +00:00
|
|
|
return "No hostname specified", false
|
|
|
|
}
|
|
|
|
return "", true
|
|
|
|
}
|