func (p MailBuilder) AddFileAttachment(path string) MailBuilder {
	// Only allow first p.err value
	if p.err != nil {
		return p
	}
	f, err := os.Open(path)
	if err != nil {
		p.err = err
		return p
	}
	b, err := ioutil.ReadAll(f)
	if err != nil {
		p.err = err
		return p
	}
	name := filepath.Base(path)
	ctype := mime.TypeByExtension(filepath.Ext(name))
	return p.AddAttachment(b, ctype, name)
}
func (p MailBuilder) AddFileAttachment(path string) MailBuilder {
	
	if p.err != nil {
		return p
	}
	f, err := os.Open(path)
	if err != nil {
		p.err = err
		return p
	}
	b, err := ioutil.ReadAll(f)
	if err != nil {
		p.err = err
		return p
	}
	name := filepath.Base(path)
	ctype := mime.TypeByExtension(filepath.Ext(name))
	return p.AddAttachment(b, ctype, name)
}
func ( p MailBuilder ) AddFileAttachment ( path string ) MailBuilder { // Only allow first p.err value if p . err != nil { return p } f , err := os . Open ( path ) if err != nil { p . err = err return p } b , err := ioutil . ReadAll ( f ) if err != nil { p . err = err return p } name := filepath . Base ( path ) ctype := mime . TypeByExtension ( filepath . Ext ( name ) ) return p . AddAttachment ( b , ctype , name ) }
// AddFileAttachment returns a copy of MailBuilder that includes the specified attachment.
// fileName, will be populated from the base name of path.  Content type will be detected from the
// path extension.
AddFileAttachment returns a copy of MailBuilder that includes the specified attachment . fileName will be populated from the base name of path . Content type will be detected from the path extension .