Loading ...
Sorry, an error occurred while loading the content.

Sender address rewrite

Expand Messages
  • Ausmus, Matt
    Hello all, This is my first post. I m using postfix 2.3.3 on some Centos 5.x boxes strictly to send mail for alerting purposes. I ve got relaying setup to go
    Message 1 of 5 , May 27, 2009
    • 0 Attachment

      Hello all,

       

      This is my first post.

       

      I’m using postfix 2.3.3 on some Centos 5.x boxes strictly to send mail for alerting purposes.  I’ve got relaying setup to go to our main smtp server which is running FreeBSD 6.x and postfix.  What I’m trying to do is for the outgoing messages to show the hostname@... so I can look at the incoming message and know what box the alert is coming from.  The scripts I’m using are utilizing mailx to send the messages.

       

      I setup sender_canonical and the address rewriting is working properly.  The problem that I’m having is that the mail is displayed in my mail client as just root.  When I open the message it shows:

       

      Root [hostname@...] or “root” <hostname@...>

       

      Depending on the client.  I checked the header of the message and it shows (this is an excerpt:  From: kennedydhcp146@... (root)).  What I want to do is get rid of “Root[…]” and just have the rewritten email address displayed in the mailbox list. 

       

      How can I accomplish this?

       

      Thanks.

       

      ____________________________

      Matt Ausmus

      Network Administrator

      Chapman University

      635 West Palm Street

      Orange, CA  92868

      (714)628-2738

      mausmus@...

       

      “Man will occasionally stumble over the truth, but most of the time he will pick himself up and continue on.”

                  - Churchill’s Commentary on Man

    • Wietse Venema
      ... You need to show what is in the email file itself, not what the mail client is showing you. Wietse
      Message 2 of 5 , May 27, 2009
      • 0 Attachment
        Ausmus, Matt:
        > Hello all,
        >
        > This is my first post.
        >
        > I'm using postfix 2.3.3 on some Centos 5.x boxes strictly to send mail
        > for alerting purposes. I've got relaying setup to go to our main smtp
        > server which is running FreeBSD 6.x and postfix. What I'm trying to do
        > is for the outgoing messages to show the hostname@... so I can
        > look at the incoming message and know what box the alert is coming from.
        > The scripts I'm using are utilizing mailx to send the messages.
        >
        > I setup sender_canonical and the address rewriting is working properly.
        > The problem that I'm having is that the mail is displayed in my mail
        > client as just root. When I open the message it shows:
        >
        > Root [hostname@...] or "root" <hostname@...>
        >
        > Depending on the client. I checked the header of the message and it
        > shows (this is an excerpt: From: kennedydhcp146@... (root)).
        > What I want to do is get rid of "Root[...]" and just have the rewritten
        > email address displayed in the mailbox list.
        >
        > How can I accomplish this?

        You need to show what is in the email file itself, not what
        the mail client is showing you.

        Wietse
      • Matt Ausmus
        Sorry for taking so long. Here s the raw email file. Return-Path: X-Original-To: mausmus@chapman.edu Delivered-To:
        Message 3 of 5 , May 28, 2009
        • 0 Attachment
          Sorry for taking so long. Here's the raw email file.

          Return-Path: <kennedydhcp146@...>
          X-Original-To: mausmus@...
          Delivered-To: mausmus@...
          Received: from duncan-kennedydhcp146.chapman.edu (law254.chapman.edu
          [206.211.146.254])
          by edric.chapman.edu (Postfix) with ESMTP id 8744D568F4
          for <mausmus@...>; Wed, 20 May 2009 16:00:00 -0700 (PDT)
          Received: by duncan-kennedydhcp146.chapman.edu (Postfix, from userid 0)
          id F02A21CF900; Wed, 20 May 2009 16:00:00 -0700 (PDT)
          To: mausmus@...
          Subject: Alert duncan-kennedydhcp146.chapman.edu updates available!
          Message-Id: <20090520230000.F02A21CF900@...>
          Date: Wed, 20 May 2009 16:00:00 -0700 (PDT)
          From: kennedydhcp146@... (root)
          X-Chapman-MailScanner-Information: Please contact the ISP for more
          information
          X-Chapman-MailScanner: Found to be clean
          X-Chapman-MailScanner-SpamCheck:
          X-Chapman-MailScanner-From: kennedydhcp146@...
          X-Spam-Status: No

          Loaded plugins: fastestmirror
          Loading mirror speeds from cached hostfile
          * rpmforge: ftp-stud.fht-esslingen.de
          * base: repos.lax-noc.com
          * updates: mirrors.cat.pdx.edu
          * addons: ftp.osuosl.org
          * extras: repos.lax-noc.com

          acpid.i386 1.0.4-7.el5_3.1 updates

          ntp.i386 4.2.2p1-9.el5.centos.2 updates


          ____________________________
          Matt Ausmus
          Network Administrator
          Chapman University
          635 West Palm Street
          Orange, CA 92868
          (714)628-2738
          mausmus@...

          "You can lead a horse to water, but if you can get him to float on his back,
          you've got something."
          -HARTLEY'S FIRST LAW

          -----Original Message-----
          From: owner-postfix-users@...
          [mailto:owner-postfix-users@...] On Behalf Of Wietse Venema
          Sent: Wednesday, May 27, 2009 6:00 PM
          To: Postfix users
          Subject: Re: Sender address rewrite

          Ausmus, Matt:
          > Hello all,
          >
          > This is my first post.
          >
          > I'm using postfix 2.3.3 on some Centos 5.x boxes strictly to send mail
          > for alerting purposes. I've got relaying setup to go to our main smtp
          > server which is running FreeBSD 6.x and postfix. What I'm trying to do
          > is for the outgoing messages to show the hostname@... so I can
          > look at the incoming message and know what box the alert is coming from.
          > The scripts I'm using are utilizing mailx to send the messages.
          >
          > I setup sender_canonical and the address rewriting is working properly.
          > The problem that I'm having is that the mail is displayed in my mail
          > client as just root. When I open the message it shows:
          >
          > Root [hostname@...] or "root" <hostname@...>
          >
          > Depending on the client. I checked the header of the message and it
          > shows (this is an excerpt: From: kennedydhcp146@... (root)).
          > What I want to do is get rid of "Root[...]" and just have the rewritten
          > email address displayed in the mailbox list.
          >
          > How can I accomplish this?

          You need to show what is in the email file itself, not what
          the mail client is showing you.

          Wietse
        • Wietse Venema
          ... The From: header of the email message has the following information: From: kennedydhcp146@chapman.edu (root) Mail clients change this information into:
          Message 4 of 5 , May 28, 2009
          • 0 Attachment
            Matt Ausmus:
            > > I'm using postfix 2.3.3 on some Centos 5.x boxes strictly to send mail
            > > for alerting purposes. I've got relaying setup to go to our main smtp
            > > server which is running FreeBSD 6.x and postfix. What I'm trying to do
            > > is for the outgoing messages to show the hostname@... so I can
            > > look at the incoming message and know what box the alert is coming from.
            > > The scripts I'm using are utilizing mailx to send the messages.
            > >
            > > I setup sender_canonical and the address rewriting is working properly.
            > > The problem that I'm having is that the mail is displayed in my mail
            > > client as just root. When I open the message it shows:
            > >
            > > Root [hostname@...] or "root" <hostname@...>
            > >
            > > Depending on the client. I checked the header of the message and it
            > > shows (this is an excerpt: From: kennedydhcp146@... (root)).
            > > What I want to do is get rid of "Root[...]" and just have the rewritten
            > > email address displayed in the mailbox list.
            > >
            > > How can I accomplish this?

            The From: header of the email message has the following information:

            From: kennedydhcp146@... (root)

            Mail clients change this information into:

            Root [kennedydhcp146@...] or "root" <kennedydhcp146@...>

            I think this is a silly request.

            To remove text, you can use a REPLACE action in a header_checks
            file that deletes the (root) portion, keeping in mind that ".",
            "(" and ")" are special characters in regular expression context.

            Here is an example that uses PCRE:

            /etc/postfix/main.cf:
            header_checks = pcre:/etc/postfix/header_checks.pcre

            /etc/postfix/header_checks.pcre:
            /^(From:\s+\S+@chapman\.edu)\s+\(root\)$/ REPLACE $1

            Wietse
          • Matt Ausmus
            Thank you. I ll test this out. ____________________________ Matt Ausmus Network Administrator Chapman University 635 West Palm Street Orange, CA 92868
            Message 5 of 5 , May 28, 2009
            • 0 Attachment
              Thank you. I'll test this out.

              ____________________________
              Matt Ausmus
              Network Administrator
              Chapman University
              635 West Palm Street
              Orange, CA 92868
              (714)628-2738
              mausmus@...

              "You can lead a horse to water, but if you can get him to float on his back,
              you've got something."
              -HARTLEY'S FIRST LAW

              -----Original Message-----
              From: owner-postfix-users@...
              [mailto:owner-postfix-users@...] On Behalf Of Wietse Venema
              Sent: Thursday, May 28, 2009 12:41 PM
              To: Postfix users
              Subject: Re: Sender address rewrite

              Matt Ausmus:
              > > I'm using postfix 2.3.3 on some Centos 5.x boxes strictly to send mail
              > > for alerting purposes. I've got relaying setup to go to our main smtp
              > > server which is running FreeBSD 6.x and postfix. What I'm trying to do
              > > is for the outgoing messages to show the hostname@... so I can
              > > look at the incoming message and know what box the alert is coming from.
              > > The scripts I'm using are utilizing mailx to send the messages.
              > >
              > > I setup sender_canonical and the address rewriting is working properly.
              > > The problem that I'm having is that the mail is displayed in my mail
              > > client as just root. When I open the message it shows:
              > >
              > > Root [hostname@...] or "root" <hostname@...>
              > >
              > > Depending on the client. I checked the header of the message and it
              > > shows (this is an excerpt: From: kennedydhcp146@... (root)).
              > > What I want to do is get rid of "Root[...]" and just have the rewritten
              > > email address displayed in the mailbox list.
              > >
              > > How can I accomplish this?

              The From: header of the email message has the following information:

              From: kennedydhcp146@... (root)

              Mail clients change this information into:

              Root [kennedydhcp146@...] or "root" <kennedydhcp146@...>

              I think this is a silly request.

              To remove text, you can use a REPLACE action in a header_checks
              file that deletes the (root) portion, keeping in mind that ".",
              "(" and ")" are special characters in regular expression context.

              Here is an example that uses PCRE:

              /etc/postfix/main.cf:
              header_checks = pcre:/etc/postfix/header_checks.pcre

              /etc/postfix/header_checks.pcre:
              /^(From:\s+\S+@chapman\.edu)\s+\(root\)$/ REPLACE $1

              Wietse
            Your message has been successfully submitted and would be delivered to recipients shortly.