lwc:linux:postfix

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lwc:linux:postfix [2021/11/11 05:59] John Harrisonlwc:linux:postfix [2025/10/20 15:40] (current) John Harrison
Line 24: Line 24:
 sudo postfix stop; sudo postfix start; sudo postfix reload sudo postfix stop; sudo postfix start; sudo postfix reload
 </code> </code>
 +=== Alternative allowing multiple from addresses to map to multiple to addresses (better than above solution?) ===
 +from [[https://serverfault.com/questions/147921/forcing-the-from-address-when-postfix-relays-over-smtp]] (example shown):
 +<code>
 +/etc/postfix/main.cf:
 +    smtp_generic_maps = hash:/etc/postfix/generic
 +
 +/etc/postfix/generic:
 +    user@localdomain.local      account@isp.example.com
 +    @localdomain.local          wholedomain@isp.example.com
 +Then do:
 +
 +sudo postmap /etc/postfix/generic
 +sudo /etc/init.d/postfix reload
 +</code>
 +
 === Remap root@localhost to another to address === === Remap root@localhost to another to address ===
   * add ''root:        <EMAILADDR>'' to ''/etc/aliases''   * add ''root:        <EMAILADDR>'' to ''/etc/aliases''
Line 37: Line 52:
 </code> </code>
 or [[https://www.thomas-krenn.com/en/wiki/Test_TCP_Port_25_(smtp)_access_with_telnet|test with telnet]] or [[https://www.thomas-krenn.com/en/wiki/Test_TCP_Port_25_(smtp)_access_with_telnet|test with telnet]]
 +
 === Tips === === Tips ===
 +
   * postfix should be set up with no configuration. When you do this, there are instructions given at the end to copy some sort of sample configuration.   * postfix should be set up with no configuration. When you do this, there are instructions given at the end to copy some sort of sample configuration.
   * to reconfigure: ''sudo dpkg-reconfigure postfix''   * to reconfigure: ''sudo dpkg-reconfigure postfix''
Line 45: Line 62:
   * flush queued mail: ''postqueue -f''   * flush queued mail: ''postqueue -f''
   * purge all queued mail: ''sudo postsuper -d ALL''   * purge all queued mail: ''sudo postsuper -d ALL''
 +  * testing smtp connection and credentials from cli
 +    * port 465: ''swaks --to recipient@example.com --from sender@yourdomain.com --server smtp-server --port 465 --tls-on-connect --auth-user 'your_username' --auth-password 'your_password' ''
 +    * port 587: ''swaks --to recipient@example.com --from sender@yourdomain.com --server smtp-server --auth-user 'your_username' --auth-password 'your_password' -p 587 --tls''
 +    * //port 465 is legacy and 587 is the better choice for modern systems//
 +
 +
 +
 +
 +
 +
 +
 ==== Optional ==== ==== Optional ====
   * get current hostname: ''hostname''   * get current hostname: ''hostname''
   * set hostname with ''hostnamectl set-hostname <HOSTNAME>''   * set hostname with ''hostnamectl set-hostname <HOSTNAME>''
  
  • lwc/linux/postfix.1636631974.txt.gz
  • Last modified: 2021/11/11 05:59
  • by John Harrison