attMultipart: text body + base64 PDF (index 0) + named inline png (index 1).
()
| 19 | |
| 20 | // attMultipart: text body + base64 PDF (index 0) + named inline png (index 1). |
| 21 | func attMultipart() []byte { |
| 22 | pdf := base64.StdEncoding.EncodeToString([]byte("%PDF-1.4 hello")) |
| 23 | png := base64.StdEncoding.EncodeToString([]byte("\x89PNG bytes")) |
| 24 | return []byte("From: a@x.com\r\nTo: support@acme.com\r\nSubject: hi\r\n" + |
| 25 | "Content-Type: multipart/mixed; boundary=B\r\n\r\n" + |
| 26 | "--B\r\nContent-Type: text/plain\r\n\r\nbody\r\n" + |
| 27 | "--B\r\nContent-Type: application/pdf\r\nContent-Disposition: attachment; filename=\"report.pdf\"\r\nContent-Transfer-Encoding: base64\r\n\r\n" + pdf + "\r\n" + |
| 28 | "--B\r\nContent-Type: image/png\r\nContent-Disposition: inline; filename=\"logo.png\"\r\nContent-Transfer-Encoding: base64\r\n\r\n" + png + "\r\n" + |
| 29 | "--B--\r\n") |
| 30 | } |
| 31 | |
| 32 | // attBig: one attachment whose DECODED size exceeds the 256 KB inline cap. |
| 33 | func attBig() []byte { |