# Powermta 5.5 Records ## 12.2 Accounting records PowerMTA writes various accounting records for every recipient. The various record types can be stored all in one file, or in separate files by record type. The record types are “d” for delivered, “b” for bounced, “t” for transient, “tq” for transient-queue, “r” for received, "f" for feedback loop records and "rb"/"rs" for remote bounce or remote status records. By default, only “d” and “b” records are recorded. ### 12.2.1 "Successful delivered" Records The following are all the available fields that can be configured for “d” (delivered) records. |(record-fields) | Description | | -------- | -------- | |type | Type of record (“d” or “delivery”) (Note: this field is always logged and cannot be disabled or changed). | |timeLogged | Time the record was delivered and logged to the accounting file | |timeQueued | Time message was queued to disk |timeFirstAttempt | Time message delivery was first attempted |totalSecondsQueued | the total amount of time in seconds, between |reception to delivery |orig | originator (from MAIL FROM:<x>) |rcpt | recipient (RCPT TO:<x>) being reported |orcpt | original recipient (from RCPT TO:... ORCPT=x), immediately following the recipient to which it refers |dsnAction | DSN action for the recipient to which it refers (Relayed means the message was passed on to another MTA, one that doesn't |support the DSN extensions. Delivered means the MTA that issued the |report actually did the final delivery.) |dsnStatus | DSN status for the recipient to which it refers |dsnDiag |DSN diagnostic string for the recipient to which it refers |dsnMta | DSN remote MTA for the recipient to which it refers |bounceCat | likely category of the bounce (see Bounce Categories), |following the recipient which it refers |srcType | source type from which the message was received, either |api or smtp |srcMta | source from which the message was received. the MTA name (from |the HELO/EHLO command) for messages received through SMTP |dlvType | delivery method, one of smtp, pipe, discard, or file |dlvSourceIp | local IP address PowerMTA used for delivery |dlvDestinationIp | IP address of the mailer to which the |report/message was delivered |dlvEsmtpAvailable | SMTP extensions supported by receiving mailer |dlvSize | report/message size in bytes |vmta |VirtualMTA selected for this message, if any |jobId | job ID for the message, if any |envId |envelope Id, from MAIL FROM:... ENVID=x (present only if specified) |queue | domain/vmta used for delivery (remote status only) |vmtaPool | VirtualMTA pool selected for this message, if any (remote status only) |header_XXX | for each custom header included where XXX is the name of the header, if any |userString | String added to accounting file as defined by the <acct-file> directive user-string. | |dlvTlsProtocol | The TLS version that was negotiated with the remote end during STARTTLS | |dlvTlsCipher | The TLS cipher that was negotiated with the remote end during STARTTLS |rcvSmtpUser | The SMTP authenticated user that submitted the message |dlvProxyName | The proxy name used for delivery |dlvProxyServer | The proxy server PowerMTA connects to for delivery, |including hostname (if present), IP address and port |dlvProxyClientIp |The sending IP address on proxy server to connect |to the remote MTA. When proxy is used, it has the same value as dlvSourceIp |dlvProxyClientHostname |The EHLO hostname presented to the remote MTA |when connecting through a proxy | |dlvProxyLocalIp | The local IP address on PowerMTA used to connect to the proxy | Sample accounting entry for a delivery record (CSV format): ``` d,2019-02-08 21:54:05+0000,2019-02-08 21:54:05+0000,AA-D=1181.com@bounce.bar.com,D@1181.com,,relayed,2.0.0 (success),smtp;250 DATA ok,foo.int.port25.com (10.1.2.3),,api,foo.int.port25.com (127.0.0.1),smtp,10.1.2.3,10.1.2.3,"ENHANCEDSTATUSCODES,8BITMIME,SMTPUTF8",41159,vmta48,JoBID29546016861868,,1181.com/vmta48 ``` ### 12.2.2 “Bounced” Records The following are all the available fields that can be configured for “b” (bounced) records. |(record-fields) | Description | | -------- | -------- | |type | Type of record (“b” or “bounce”) (Note: this field is always logged and cannot be disabled or changed). | |timeLogged | Time the record was delivered and logged to the accounting file | |timeQueued | Time message was queued to disk | | timeFirstAttempt | Time message delivery was first attempted |totalSecondsQueued | the total amount of time in seconds, between reception to delivery |orig | originator (from MAIL FROM:<x>) |rcpt | recipient (RCPT TO:<x>) being reported |orcpt | original recipient (from RCPT TO:... ORCPT=x), immediately following the recipient to which it refers |dsnAction | DSN action for the recipient to which it refers |dsnStatus | DSN status for the recipient to which it refers |dsnDiag | DSN diagnostic string for the recipient to which it refers |dsnMta | DSN remote MTA for the recipient to which it refers |bounceCat | likely category of the bounce (see Bounce Categories), following the recipient which it refers |srcType | source type from which the message was received, either 'api' or 'smtp' |srcMta | No data present in Bounce Record |dlvType | No data present in Bounce Record |dlvSourceIp | No data present in Bounce Record |dlvDestinationIp | No data present in Bounce Record |dlvEsmtpAvailable | No data present in Bounce Record |dlvSize | Deprecated. No data present in Bounce Record |vmta | VirtualMTA selected for this message, if any |jobId | job ID for the message, if any |envId | envelope Id, from MAIL FROM:... ENVID=x (present only if specified) |queue | domain/vmta used for delivery (remote status only) |vmtaPool | VirtualMTA pool selected for this message, if any (remote status only) |header_XXX | for each custom header included where XXX is the name of the header, if any |userString | String added to accounting file as defined by the <acct-file> directive user-string. |dlvTlsProtocol | The TLS version that was negotiated with the remote end during STARTTLS |dlvTlsCipher | The TLS cipher that was negotiated with the remote end during STARTTLS |rcvSmtpUser | The SMTP authenticated user that submitted the message |dlvProxyName | The proxy name used for delivery |dlvProxyServer | The proxy server PowerMTA connects to for delivery, including hostname (if present), IP address and port |dlvProxyClientIp | The sending IP address on proxy server to connect to the remote MTA |dlvProxyClientHostname | The EHLO hostname presented to the remote MTA when connecting through a proxy |dlvProxyLocalIp | The local IP address on PowerMTA used to connect to the proxy | Sample accounting entry for a bounce record (CSV format): ``` b,2019-02-08 21:53:41+0000,2019-02-08 21:53:41+0000,CB-A=yahoo.com@bounce.bar.com,A@yahoo.com,,failed,5.7.1 (delivery not authorized),smtp;554 5.7.1 Denied - Spam Suspected - http://www.w357sfhsjhf873.net/services/spamwatch/blocked.php,foo.int.bar.com (10.1.2.3),spam-related,api,foo.int.bar.com (127.0.0.1),smtp,10.1.2.3,10.1.2.3,"ENHANCEDSTATUSCODES,8BITMIME,SMTPUTF8",,vmta18,,,yahoo.rollup/vmta18 ``` ### 12.2.7 “Feedback Loop” Records PowerMTA can log feedback loop reports in the accounting file. This logging is handled with the record type “f”. The records when using “f” are slightly different than those mentioned above. The fields available are as follows: |(record-fields) | Description | | -------- | -------- | |type | Type of record “f” (Note: this field is always logged and cannot be disabled or changed). |timeLogged | Current time |repSourceIp | the IP of PowerMTA that received the message |feedbackType | mapped to ARF's Feedback-Type field |format | arf or jmrp or the name of the file containing the body-|pattern-file | pattern that matched this report |userAgent | name & version of the program that generated the report |envid | envelope ID (of original email) |orig | originator address (of original email) |rcpt | recipient address (of original email) |reportingMTA | the name of the MTA generating this feedback report |dlvSourceIp | address of MTA from which the message was received |reportedDomain | the domain about which the feedback report was generated |header_<name> | header extracted from original email |arf_<name> | field from ARF feedback-report Sample accounting entry for a FBL record (CSV format): ``` f,2010-04-12 11:40:37-0400,arf,AOL SComp,,,,mail1.domain.com,169.63.151.30 ``` #### 12.2.7 PowerMTA will send a JSON webhook to a destination here is an example ##### Delivered ``` {"type":"d","timeLogged":"2023-01-02 00:04:40+0100","timeQueued":"2023-01-02 00:04:39+0100","orig":"info@connectain.com","rcpt":"mady@domyshoot.co","orcpt":"","dsnAction":"relayed","dsnStatus":"2.0.0 (success)","dsnDiag":"smtp;250 2.0.0 OK 1672614296 ck12-20020a5d5e8c000000b0029a23d6f1b0si612771wrb.891 - gsmtp","dsnMta":"aspmx.l.google.com (66.102.1.26)","srcType":"smtp","srcMta":"[127.0.0.1] (54.87.24.146)","dlvType":"smtp","dlvSourceIp":"213.32.48.234","dlvDestinationIp":"66.102.1.26","dlvEsmtpAvailable":"ENHANCEDSTATUSCODES,PIPELINING,CHUNKING,8BITMIME,SIZE,STARTTLS,SMTPUTF8","dlvSize":"1296","vmta":"vmta8","jobId":"<c8de55f1-a508-ae75-a793-f88fbfcf1977@connectain.com>","envId":"","queue":"domyshoot.co/vmta8","vmtaPool":"mta-pool3"} {"type":"d","timeLogged":"2023-01-02 00:35:44+0100","timeQueued":"2023-01-02 00:35:43+0100","orig":"info@connectain.com","rcpt":"elsa@nacepartners.com","orcpt":"","dsnAction":"relayed","dsnStatus":"2.0.0 (success)","dsnDiag":"smtp;250 2.0.0 OK 1672616160 a2-20020adfe5c2000000b002425a60dc88si5887135wrn.688 - gsmtp","dsnMta":"aspmx.l.google.com (64.233.184.27)","srcType":"smtp","srcMta":"[127.0.0.1] (54.87.24.146)","dlvType":"smtp","dlvSourceIp":"54.37.190.215","dlvDestinationIp":"64.233.184.27","dlvEsmtpAvailable":"ENHANCEDSTATUSCODES,PIPELINING,CHUNKING,8BITMIME,SIZE,STARTTLS,SMTPUTF8","dlvSize":"2321","vmta":"vmta7","jobId":"<6cd7816f-7b7f-551c-6f22-b52a31602b38@connectain.com>","envId":"","queue":"nacepartners.com/vmta7","vmtaPool":"mta-pool3"} { ``` Bounced ``` {"type":"b","timeLogged":"2023-01-02 09:28:25+0100","timeQueued":"2023-01-02 09:28:24+0100","orig":"andrea.solomon@marketing-globalbsg.com","rcpt":"Aaron.Gonzalez@tevaeu.com","orcpt":"","dsnAction":"failed","dsnStatus":"5.0.0 (undefined status)","dsnDiag":"smtp;550 #5.1.0 Address rejected.","dsnMta":"mx01.tevapharm.com (192.115.249.173)","bounceCat":"other","srcType":"smtp","srcMta":"ema.doox.cloud (137.74.189.147)","dlvType":"smtp","dlvSourceIp":"217.182.4.254","dlvDestinationIp":"192.115.249.173","dlvEsmtpAvailable":"8BITMIME,SIZE,STARTTLS","dlvSize":"","vmta":"vmta4","jobId":"<4cc32cb0a9a065e4805c4b5e01026d4b488a40a9@marketing-globalbsg.com>","envId":"","queue":"tevaeu.com/vmta4","vmtaPool":"mta-pool1"} {"type":"b","timeLogged":"2023-01-02 09:28:25+0100","timeQueued":"2023-01-02 09:28:25+0100","orig":"andrea.solomon@marketing-globalbsg.com","rcpt":"A.AnaTeixeira@ihss.co.uk","orcpt":"","dsnAction":"failed","dsnStatus":"5.0.0 (undefined status)","dsnDiag":"smtp;550 #5.1.0 Address rejected.","dsnMta":"mx01b.vamed.com (80.120.168.5)","bounceCat":"other","srcType":"smtp","srcMta":"ema.doox.cloud (137.74.189.147)","dlvType":"smtp","dlvSourceIp":"217.182.4.254","dlvDestinationIp":"80.120.168.5","dlvEsmtpAvailable":"8BITMIME,SIZE,STARTTLS","dlvSize":"","vmta":"vmta4","jobId":"<73926073cbb2db5b5c5cc2d83bf183377bba1485@marketing-globalbsg.com>","envId":"","queue":"ihss.co.uk/vmta4","vmtaPool":"mta-pool1"} { ``` ### 12.6 Bounce Categories For easier classification of the actual reason for a bounce, pmtastats groups bounces in bounce categories. All bounces in a category have probably the same root cause, e.g. all messages in a category may be considered spam or another category may indicate the recipient is unknown. Using the various bounce codes and DSN reasons, pmtastats aggregates these message in likely bounce categories. This gives a good overview of why messages could not be delivered. The categories are customizable using the <bounce-category-patterns> tag (see Use of Bounce Category Patterns). Any new or custom categories would be show in the pmtastats output as well as in the accounting file itself. The bounce category is included in the accounting file (the bounceCat tag, see "Successful delivered" Records). It can be obtained directly from the CSV file or be used in acctfind. Currently, these bounce categories are defined: |category | description | -------- | -------- | |bad-configuration | messages rejected due to configuration issues with remote host, 5.X.X error bad-connection | messages bounced due to bad connection issues with remote host, 4.X.X error bad-domain | messages bounced due to invalid or non-existing domains, 5.X.X error bad-mailbox | messages rejected due to bad, invalid, or non-existent recipient addresses, 5.X.X error content-related | messages refused or blocked due to content related reasons, 5.X.X error inactive-mailbox | messages rejected due to expired, inactive, or disabled recipient addresses, 5.X.X error invalid-sender | messages bounced due to invalid DNS or MX entry for sending domain message-expired | messages bounced due to not being delivered before the bounce-after, 4.X.X error no-answer-from-host | messages bounces due to receiving no response from remote host after connecting, 4.X.X or 5.X.X error other | messages rejected due to other reasons, 4.X.X or 5.X.X error policy-related | messages refused or blocked due to general policy reasons, 5.X.X error protocol-errors | messages rejected due to SMTP protocol syntax or sequence errors, 5.X.X error quota-issues | messages rejected or blocked due to mailbox quota issues, 4.X.X or 5.X.X error relaying-issues | messages refused or blocked due to remote mail server relaying issues, 5.X.X error routing-errors | messages bounced due to mail routing issues for recipient domain, 5.X.X error spam-related | messages refused or blocked due to spam related reasons, 5.X.X error virus-related | messages refused or blocked due to virus related reasons, 5.X.X error