|
@@ -53,8 +53,11 @@ func (e *Email) Bytes() []byte {
|
|
|
}
|
|
|
|
|
|
//Send an email using the given host and SMTP auth (optional)
|
|
|
-func (e *Email) Send(addr string, a smtp.Auth) {
|
|
|
-
|
|
|
+//This function merges the To, Cc, and Bcc fields and calls the smtp.SendMail function using the Email.Bytes() output as the message
|
|
|
+func (e *Email) Send(addr string, a smtp.Auth) error {
|
|
|
+ // Merge the To, Cc, and Bcc fields
|
|
|
+ to := append(append(e.To, e.Cc...), e.Bcc...)
|
|
|
+ return smtp.SendMail(addr, a, e.From, to, e.Bytes())
|
|
|
}
|
|
|
|
|
|
//Attachment is a struct representing an email attachment.
|