Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Disable mail service before making any further changes.

    Code Block
    titleDisable mail service
    # svcadm disable postfix


  2. Edit /etc/postfix/main.cf and add this setting: sender_canonical_maps = regexp:/etc/postfix/sender_canonical so that the before and after look like the following. Notice change on line 26.

    Code Block
    titleChange to /etc/postfix/main.cf
    +++ Before +++
    ...
     20 #
     21 # Maps and Aliases
     22 #
     23 alias_database = dbm:/etc/postfix/aliases
     24 local_recipient_maps = unix:passwd.byname $alias_maps
     25 alias_maps = dbm:/etc/postfix/aliases
     26
     27 # Debug level
    ...
    
    
    +++ After +++
    ...
     20 #
     21 # Maps and Aliases
     22 #
     23 alias_database = dbm:/etc/postfix/aliases
     24 local_recipient_maps = unix:passwd.byname $alias_maps
     25 alias_maps = dbm:/etc/postfix/aliases
     26 sender_canonical_maps = regexp:/etc/postfix/sender_canonical
     27
     28 # Debug level
    ...


  3. Now we create a mapping using a regular expression with the following command. However, replace in this example no-reply@yourdomain.com with an appropriate email address specific to your environment. This mapping effectively matches an email address that the machine generates based on its current hostname, which usually won't be internet legal such as root@localhost.localdomain will rewrite it to no-reply@yourdomain.com as in this example.

    Code Block
    titleCreate address mapping
    # echo '/^(.*)@(.*)$/ no-reply@yourdomain.com' > /etc/postfix/sender_canonical


  4. Enable mail service again which should instantiate this mapping and all new emails produced on the box will have their FROM: field re-written to match the right side of value in step 3.

    Code Block
    titleEnable mail service
    # svcadm enable postfix


 

Info

...