# Postfix: Tips

##### postfix 服務

服務啟動/停止/重新載入

```shell
postfix check
postfix start
postfix stop
postfix reload
postfix flush
```

##### postconf - 不用編輯 main.cf 的設定方法

列出設定參數

```shell
postconf -n
```

修改參數  
\*不需要重啟服務\*

```shell
postconf -e "relayhost = [192.168.10.10]:587" \
"smtp_sasl_auth_enable = yes" \
"smtp_sasl_security_options = noanonymous" \
"smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd" \
"smtp_use_tls = yes" \
"smtp_tls_security_level = encrypt" \
"smtp_tls_note_starttls_offer = yes"
```

移除參數

```bash
postconf -# smtp_use_tls
```

##### No main.cf

> postconf: fatal: open /etc/postfix/main.cf: No such file or directory

Solution:

```bash
dpkg-reconfigure postfix
```

##### Test SMTP

[Swaks](http://www.jetmore.org/john/code/swaks/) is a featureful, flexible, scriptable, transaction-oriented SMTP test tool written and maintained by John Jetmore. It is free to use and licensed under the GNU GPLv2.

##### 外部網站

- [How to configure AWS SES with Postfix MTA](https://www.cyberciti.biz/faq/how-to-configure-aws-ses-with-postfix-mta/)