|
@@ -1,4 +1,4 @@
|
|
-//Email is designed to be a package providing an "email interface for humans."
|
|
|
|
|
|
+//Package email is designed to be a package providing an "email interface for humans."
|
|
//Designed to be robust and flexible, the email package aims to make sending email easy without getting in the way.
|
|
//Designed to be robust and flexible, the email package aims to make sending email easy without getting in the way.
|
|
package email
|
|
package email
|
|
|
|
|
|
@@ -35,9 +35,9 @@ func NewEmail() *Email {
|
|
}
|
|
}
|
|
|
|
|
|
//Attach is used to attach a file to the email.
|
|
//Attach is used to attach a file to the email.
|
|
-//It attempts to open the file reference by filename and, if successful, creates an Attachment.
|
|
|
|
|
|
+//It attempts to open the file referenced by filename and, if successful, creates an Attachment.
|
|
//This Attachment is then appended to the slice of Email.Attachments.
|
|
//This Attachment is then appended to the slice of Email.Attachments.
|
|
-//The function will then return the Attachment for reference, as well as nil for the error if successful.
|
|
|
|
|
|
+//The function will then return the Attachment for reference, as well as nil for the error, if successful.
|
|
func (e *Email) Attach(filename string) (a *Attachment, err error) {
|
|
func (e *Email) Attach(filename string) (a *Attachment, err error) {
|
|
//Check if the file exists, return any error
|
|
//Check if the file exists, return any error
|
|
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
|
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
|
@@ -63,7 +63,7 @@ func (e *Email) Attach(filename string) (a *Attachment, err error) {
|
|
return e.Attachments[filename], nil
|
|
return e.Attachments[filename], nil
|
|
}
|
|
}
|
|
|
|
|
|
-//Bytes converts the Email object to a []byte representation of it, including all needed MIMEHeaders, boundaries, etc.
|
|
|
|
|
|
+//Bytes converts the Email object to a []byte representation, including all needed MIMEHeaders, boundaries, etc.
|
|
func (e *Email) Bytes() []byte {
|
|
func (e *Email) Bytes() []byte {
|
|
buff := bytes.Buffer{}
|
|
buff := bytes.Buffer{}
|
|
//w := multipart.NewWriter(&buff)
|
|
//w := multipart.NewWriter(&buff)
|