(utf8 bool, w *textproto.MultipartWriter, mtaInfo ReportingMTAInfo, rcptsInfo []RecipientInfo)
| 231 | } |
| 232 | |
| 233 | func writeMachineReadablePart(utf8 bool, w *textproto.MultipartWriter, mtaInfo ReportingMTAInfo, rcptsInfo []RecipientInfo) error { |
| 234 | machineHeader := textproto.Header{} |
| 235 | if utf8 { |
| 236 | machineHeader.Add("Content-Type", "message/global-delivery-status") |
| 237 | } else { |
| 238 | machineHeader.Add("Content-Type", "message/delivery-status") |
| 239 | } |
| 240 | machineHeader.Add("Content-Description", "Delivery report") |
| 241 | machineWriter, err := w.CreatePart(machineHeader) |
| 242 | if err != nil { |
| 243 | return err |
| 244 | } |
| 245 | |
| 246 | // WriteTo will add an empty line after output. |
| 247 | if err := mtaInfo.WriteTo(utf8, machineWriter); err != nil { |
| 248 | return err |
| 249 | } |
| 250 | |
| 251 | for _, rcpt := range rcptsInfo { |
| 252 | if err := rcpt.WriteTo(utf8, machineWriter); err != nil { |
| 253 | return err |
| 254 | } |
| 255 | } |
| 256 | return nil |
| 257 | } |
| 258 | |
| 259 | // failedText is the text of the human-readable part of DSN. |
| 260 | var failedText = template.Must(template.New("dsn-text").Parse(` |
no test coverage detected