It is already built in to Thunderbird.
See
https://wiki.mozilla.org/MailNews:Logging
Start Thunderbird with these two environment variables set
NSPR_LOG_MODULES=SMTP:5,timestamp
NSPR_LOG_FILE=/tmp/thunderbird__smtp.log ### or your choice of path/file
Then send the "Delivery Status Notification" email message.
Here is an annotated example of a log file:
| 2016-09-23 23:35:13.408000 UTC - 4792[1411140]: SMTP Connecting to:
smtp.wapakiwi.reg.nz
| 2016-09-23 23:35:15.674000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:15.674000 UTC - 4792[1411140]: SMTP Response: 220
wapakiwi.reg.nz ESMTP ready
....Outbound mail server "greeting".
| 2016-09-23 23:35:15.674000 UTC - 4792[1411140]: SMTP entering state: 14
| 2016-09-23 23:35:15.674000 UTC - 4792[1411140]: SMTP Send: EHLO [192.168.43.99]
....Thunderbird EHLO (extended hello) to the outbound mail server.
| 2016-09-23 23:35:16.002000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:16.002000 UTC - 4792[1411140]: SMTP Response:
250-wapakiwi.reg.nz
| 2016-09-23 23:35:16.002000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP Response: 250-SIZE 10240000
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP Response: 250-ENHANCEDSTATUSCODES
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP Response: 250-8BITMIME
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP Response: 250 DSN
....Outbound mail server announcing its capabilities.
"DSN" means the server will accept "Delivery Status Notification" requests in the SMTP envelope.
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP entering state: 4
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP entering state: 21
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP auth: server caps 0x34, pref 0x40000, failed 0x0, avail caps 0x0
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: (GSSAPI = 0x800, CRAM = 0x2000, NTLM = 0x4000, MSN = 0x8000, PLAIN = 0x200, LOGIN = 0x100, EXTERNAL = 0x400)
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: no auth method remaining
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP entering state: 3
| 2016-09-23 23:35:16.049000 UTC - 4792[1411140]: SMTP Send: MAIL FROM:<
robin...@wapakiwi.reg.nz> RET=FULL ENVID=<
bfe14340-7d96-94db...@xtra.co.nz> BODY=8BITMIME SIZE=1100
....Thunderbird sets the MAIL FROM address in the SMTP envelope.
| 2016-09-23 23:35:16.564000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:16.564000 UTC - 4792[1411140]: SMTP Response: 250 2.1.0 Ok
| 2016-09-23 23:35:16.564000 UTC - 4792[1411140]: SMTP entering state: 5
| 2016-09-23 23:35:16.564000 UTC - 4792[1411140]: SMTP Send: RCPT TO:<-rf...@xn--kba.invalid> NOTIFY=SUCCESS,FAILURE,DELAY ORCPT=
rfc822;robin...@wapakiwi.reg.nz
....Thunderbird sets one recipient in the SMTP envelope.
At the same time, Thunderbird says it wants a "Delivery Status Notification" response
for any of: Successful delivery, Permanent Failure, or Email Delayed (= temporary error, retry later).
TECH REF:
https://tools.ietf.org/html/rfc3461#section-4.1
| 2016-09-23 23:35:17.033000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:17.033000 UTC - 4792[1411140]: SMTP Response: 250 2.1.5 Ok
....Outbound mail server accepts the recipient and the "Delivery Status Notification" request
for that recipient.
| 2016-09-23 23:35:17.033000 UTC - 4792[1411140]: SMTP entering state: 6
| 2016-09-23 23:35:17.033000 UTC - 4792[1411140]: SMTP Send: DATA
|
| 2016-09-23 23:35:17.252000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:17.252000 UTC - 4792[1411140]: SMTP Response: 354 End data with <CR><LF>.<CR><LF>
| 2016-09-23 23:35:17.252000 UTC - 4792[1411140]: SMTP entering state: 7
| 2016-09-23 23:35:17.252000 UTC - 4792[1411140]: SMTP entering state: 8
| 2016-09-23 23:35:17.267000 UTC - 4792[1411140]: SMTP Send: .
....This is Thunderbird sending the email (headers and body).
| 2016-09-23 23:35:18.267000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:18.267000 UTC - 4792[1411140]: SMTP Response: 250 2.0.0 Ok: queued as 17916C07CA90
....Outbound mail server accepts the email.
| 2016-09-23 23:35:18.267000 UTC - 4792[1411140]: SMTP entering state: 9
| 2016-09-23 23:35:18.267000 UTC - 4792[1411140]: SMTP Send: QUIT
|
| 2016-09-23 23:35:18.267000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:18.377000 UTC - 4792[1411140]: SMTP entering state: 0
| 2016-09-23 23:35:18.377000 UTC - 4792[1411140]: SMTP Response: 221 2.0.0 Bye
--
Kind regards
Ralph