### 邮件服务器(mail.unotes.co)收到 test01\@unotes.co 发送给 test.redhat\@gmail.com 邮件的日志
```bash
$ tail -f /var/log/maillog
```
**`收到客户端x.x.196.255的连接请求`**
```bash
Aug 19 05:49:42 mail postfix/smtps/smtpd[10057]: connect from unknown[x.x.196.255]
```
**`用户test01@unotes.co通过sasl认证登录成功`**
```bash
Aug 19 05:49:43 mail postfix/smtps/smtpd[10057]: EA8FF222F6: client=unknown[x.x.196.255], sasl_method=LOGIN, sasl_username=test01@unotes.co
```
**`postfix cleanup清理邮件,处理好的邮件,会被传入收件队列(Incoming Queue)`**
```bash
Aug 19 05:49:44 mail postfix/cleanup[10064]: EA8FF222F6: message-id=<2018081917494313210561@unotes.co>
```
**`opendkim会检查发送邮件的DKIM签名是否通过`**
```bash
Aug 19 05:49:44 mail opendkim[10046]: EA8FF222F6: DKIM-Signature field added (s=default, d=unotes.co)
```
**`qmgr把邮件放入active队列`**
```bash
Aug 19 05:49:44 mail postfix/qmgr[7739]: EA8FF222F6: from=<test01@unotes.co>, size=1725, nrcpt=1 (queue active)
```
**`邮件服务器和gmail的smtp发起建立TLS的连接的请求`**
```bash
Aug 19 05:49:44 mail postfix/smtp[10065]: setting up TLS connection to gmail-smtp-in.l.google.com[74.125.197.26]:25
```
**`邮件服务器和gmail的smtp的TLS连接建立成功`**
```bash
Aug 19 05:49:44 mail postfix/smtp[10065]: Trusted TLS connection established to gmail-smtp-in.l.google.com[74.125.197.26]:25: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
```
**`邮件服务器发送邮件给gmail的smtp服务器`**
```bash
Aug 19 05:49:45 mail postfix/smtp[10065]: EA8FF222F6: to=<test.redhat@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.197.26]:25, delay=1.8, delays=0.74/0.03/0.19/0.82, dsn=2.0.0, status=sent (250 2.0.0 OK 1534672190 g10-v6si7304311pfd.86 - gsmtp)
```
**`qmgr把邮件移除`**
```bash
Aug 19 05:49:45 mail postfix/qmgr[7739]: EA8FF222F6: removed
```
**`客户端x.x.196.255断开连接`**
```bash
Aug 19 05:49:49 mail postfix/smtps/smtpd[10057]: disconnect from unknown[x.x.196.255]
```
### 邮件服务器(mail.unotes.co)收到 test.redhat\@gmail.com 发送给 test01\@unotes.co 邮件的日志
**`gmail客户端请求连接邮件服务器`**
```bash
Aug 19 06:09:14 mail postfix/smtpd[10077]: connect from mail-wr1-f42.google.com[209.85.221.42]
```
**`postgrey灰名单校验通过,客户端在whitelist中`**
```bash
Aug 19 06:09:15 mail postgrey[9433]: action=pass, reason=client whitelist, client_name=mail-wr1-f42.google.com, client_address=209.85.221.42, sender=test.redhat@gmail.com, recipient=test01@unotes.co
Aug 19 06:09:15 mail postgrey[9433]: cleaning up old logs...
Aug 19 06:09:15 mail postgrey[9433]: cleaning up old entries...
Aug 19 06:09:15 mail postgrey[9433]: cleaning main database finished. before: 4, after: 4
Aug 19 06:09:15 mail postgrey[9433]: cleaning clients database finished. before: 4, after: 4
```
**`postfix cleanup清理邮件`**
```bash
Aug 19 06:09:15 mail postfix/smtpd[10077]: 974C6222F6: client=mail-wr1-f42.google.com[209.85.221.42]
Aug 19 06:09:15 mail postfix/cleanup[10083]: 974C6222F6: message-id=<CAOmnsz0oWbDCvGsjo3Q2sLoyCWeFPqsyZFdin1thTvC2NmWA5w@mail.gmail.com>
```
**`opendkim检查客户端的smtp服务器的DKIM签名成功`**
```bash
Aug 19 06:09:15 mail opendkim[10046]: 974C6222F6: mail-wr1-f42.google.com [209.85.221.42] not internal
Aug 19 06:09:15 mail opendkim[10046]: 974C6222F6: not authenticated
Aug 19 06:09:15 mail opendkim[10046]: 974C6222F6: DKIM verification successful
```
**`qmgr把邮件放入active队列`**
```bash
Aug 19 06:09:15 mail postfix/qmgr[7739]: 974C6222F6: from=<test.redhat@gmail.com>, size=9907, nrcpt=1 (queue active)
Aug 19 06:09:16 mail postfix/smtpd[10077]: disconnect from mail-wr1-f42.google.com[209.85.221.42]
Aug 19 06:09:16 mail postfix/smtpd[10088]: connect from unknown[127.0.0.1]
Aug 19 06:09:17 mail postfix/smtpd[10088]: 01373222F7: client=unknown[127.0.0.1]
Aug 19 06:09:17 mail postfix/cleanup[10083]: 01373222F7: message-id=<CAOmnsz0oWbDCvGsjo3Q2sLoyCWeFPqsyZFdin1thTvC2NmWA5w@mail.gmail.com>
```
**`opendkim检查客户端的发件人的DKIM签名不匹配(正常,因为我们没有把test.redhat@gmail.com添加到/etc/opendkim/SigningTable),smtp服务器的DKIM签名成功`**
```bash
Aug 19 06:09:17 mail opendkim[10046]: 01373222F7: no signing table match for 'test.redhat@gmail.com'
Aug 19 06:09:17 mail opendkim[10046]: 01373222F7: DKIM verification successful
```
**`qmgr再次把邮件放入active队列`**
```bash
Aug 19 06:09:17 mail postfix/qmgr[7739]: 01373222F7: from=<test.redhat@gmail.com>, size=10498, nrcpt=1 (queue active)
```
**`amavis检测通过`**
```bash
Aug 19 06:09:17 mail amavis[9854]: (09854-01) Passed CLEAN {RelayedInbound}, [209.85.221.42] [209.85.221.42] <test.redhat@gmail.com> -> <test01@codemax.cn>, Message-ID: <CAOmnsz0oWbDCvGsjo3Q2sLoyCWeFPqsyZFdin1thTvC2NmWA5w@mail.gmail.com>, mail_id: rLrGCzYXUKtd, Hits: -0.099, size: 10066, queued_as: 01373222F7, dkim_sd=20161025:gmail.com, 1077 ms
```
**`smtp把邮件发送给amavis`**
```bash
Aug 19 06:09:17 mail postfix/smtp[10084]: 974C6222F6: to=<test01@codemax.cn>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.5, delays=0.42/0.04/0.02/1.1, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 01373222F7)
```
**`qmgr把邮件移除`**
```bash
Aug 19 06:09:17 mail postfix/qmgr[7739]: 974C6222F6: removed
```
**`把邮件中继给dovecot`**
```bash
Aug 19 06:09:17 mail postfix/pipe[10090]: 01373222F7: to=<test01@codemax.cn>, relay=dovecot, delay=0.32, delays=0.06/0.01/0/0.25, dsn=2.0.0, status=sent (delivered via dovecot service)
```
**`qmgr把邮件移除`**
```bash
Aug 19 06:09:17 mail postfix/qmgr[7739]: 01373222F7: removed
```