From eedf6900b05ba90c44cfa595a2ce6e0e570988b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=B6=E0=A4=82=E0=A4=A4=E0=A4=A8=E0=A5=82?= Date: Thu, 16 Feb 2017 00:41:02 +0530 Subject: [PATCH] Added "AddAttachment" function --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 9ee6098..7309a21 100644 --- a/main.go +++ b/main.go @@ -105,6 +105,12 @@ func (m *Message) AddBcc(addresses ...string) error { return appendMailAddresses(&m.Bcc, addresses...) } +func (m *Message) AddAttachment(name string, data io.Reader) error { + m.Attachments = append(m.Attachments, Attachment{Name: name, Data: data}) + return nil + +} + // An Attachment represents an email attachment. type Attachment struct { // Name must be set to a valid file name.