code: func (m *MailYak) writeAttachments(mixed partCreator, splitter writeWrapper) error {
  	h := make([]byte, sniffLen)
  
  	for _, item := range m.attachments {
  		hLen, err := item.content.Read(h)
  		if err != nil && err != io.EOF {
  			return err
  		}
  
  		if item.mimeType == "" {
  			item.mimeType = http.DetectContentType(h[:hLen])
  		}
  
  		ctype := fmt.Sprintf("%s;\n\tfilename=%q", item.mimeType, item.filename)
  
  		part, err := mixed.CreatePart(getMIMEHeader(item, ctype))
  		if err != nil {
  			return err
  		}
  
  		encoder := base64.NewEncoder(base64.StdEncoding, splitter.new(part))
  		if _, err := encoder.Write(h[:hLen]); err != nil {
  			return err
  		}
  
  		// More to write?
  		if hLen == sniffLen {
  			if _, err := io.Copy(encoder, item.content); err != nil {
  				return err
  			}
  		}
  
  		if err := encoder.Close(); err != nil {
  			return err
  		}
  	}
  
  	return nil
  }
docs: // writeAttachments loops over the attachments, guesses their content-type and
  // writes the data as a line-broken base64 string (using the splitter mutator).