> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xorlab.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Pages under /latest/ document the current release. Paths that begin with a version number, for example /10.0/, are frozen snapshots of superseded releases kept for reference only — never present their instructions as current. If the reader's version is unknown, answer from /latest/ and say which version the answer describes.
> xorlab is deployed on-premises, hybrid, or as a cloud service, and integrates with either Microsoft 365 or on-premises mail infrastructure. Configuration steps often differ between these. State which deployment and integration mode an instruction applies to instead of presenting one as universal.
> Distinguish inline mode from monitoring mode when describing anything that acts on email. Monitoring mode observes a copy and cannot block or quarantine; inline mode routes mail through xorlab and can.
> Write the product name as lowercase 'xorlab'. Use the documented component names: xorlab Control Center (XCC), xorlab MTA, xorlab Sandbox (DANA), xorlab Natural Language Understanding (NLU). After the first mention, use the short forms XCC, MTA, Sandbox, and NLU. Do not use DANA as a standalone name for the Sandbox, but keep it where it is a literal string in configuration keys, container names, and hostnames.
> Do not invent configuration keys, rule parameters, list names, log properties, or API fields. If a value is not present in this documentation, say that it is not documented rather than guessing.

# Enable Logging via Email

> Configure xorlab to send an email whenever a chosen log event occurs.

<Warning>
  **Prerequisites**

  * Complete [Before You Begin](/latest/logging-before-begin)
</Warning>

Follow these steps:

1. Open the `logback-audit.xml` as created in [Before You Begin](/latest/logging-before-begin#choose-log-event).

2. Add the following `appender` and `logger`. Depending on the host that will do the logging, the `appender` looks a bit different. You can identify the host (MTA vs XCC) that will do the logging based on the event that you want to log, as described in [Before You Begin](/latest/logging-before-begin#choose-log-event).

   <Tabs>
     <Tab title="MTA">
       ```xml /activeguard/core/logback-audit.xml theme={null}
       <?xml version="1.0" encoding="UTF-8"?>
       <included>
           <!-- Set to your xorlab domain -->
           <property name="host.name" value="xyz.activeguard.cloud"/>

           <appender name="smtpMailAppender" class="ch.qos.logback.classic.net.SMTPAppender">
               <from>no-reply@${host.name}</from>
               <to>example@xorlab.com</to>
               <subject>Email reported via ${host.name}</subject>

               <layout class="ch.qos.logback.classic.PatternLayout">
                   <pattern>An email was reported\nDate: %d{yyyy-MM-dd HH:mm}\nLink https://${host.name}/messages/all/message/%X{gr.id} \n%jsonMsg\n</pattern>
               </layout>

               <smtpHost>mta.activeguard.xor</smtpHost>
               <smtpPort>10026</smtpPort>
               <evaluator class="com.xorlab.sgappliance.shared.logback.evaluator.LevelEvaluator"/>
           </appender>

           <!-- Change the name to the desired Event -->
           <logger name="trace.msg_analysis.complete.reported">
               <appender-ref ref="smtpMailAppender"/>
           </logger>

       </included>
       ```
     </Tab>

     <Tab title="XCC">
       <Warning>
         **TLS Limitation**

         This configuration requires that `smtpd_tls_req_ccert = no` is set inside `/activeguard/mta/startup_cfg/postfix_custom/main.cf`.
       </Warning>

       ```xml /xcc/backend/logback-audit.xml theme={null}
       <?xml version="1.0" encoding="UTF-8"?>
       <included>
           <!-- TODO Set to your xorlab domain -->
           <property name="host.name" value="xyz.activeguard.cloud"/>

           <appender name="smtpMailAppender" class="ch.qos.logback.classic.net.SMTPAppender">
               <from>no-reply@${host.name}</from>
               <to>example@xorlab.com</to>
               <subject>Email Release Request ${host.name}</subject>

               <layout class="ch.qos.logback.classic.PatternLayout">
               <!-- feel free to change the email content here --> 
               <pattern>An email was requested for release\nDate: %d{yyyy-MM-dd HH:mm}\nLink: https://${host.name}/messages/all/message/%logArg{ggrid} \n\n</pattern>
               </layout>

               <!-- TODO Set to you the MX records that resolves to the xorlab MTAs -->
               <smtpHost>mx.xyz.activeguard.cloud</smtpHost>
               <smtpPort>25</smtpPort>
               <STARTTLS>true</STARTTLS>
               <evaluator class="com.xorlab.sgappliance.shared.logback.evaluator.LevelEvaluator"/>
           </appender>

           <!-- Change the name to the desired Event -->
           <logger name="audit.quarantine.release.request.created">
               <appender-ref ref="smtpMailAppender"/>
           </logger>

       </included>
       ```
     </Tab>
   </Tabs>

3. Set `host.name` to the domain of your xorlab.

4. Adjust `to`, `subject` and `pattern` to match the desired email content and destination.

5. Adjust the `logger name` to match the event that you want to log.

6. Click **Publish**. The logging configuration becomes active within about one minute.
