wiki:TipAndDoc/network/mail/.forward

.forward

  • sample of .forward
    "|ls > hoge"
    "|id > /home/XXXXXXXX/s0711489/id.log"
    "|pwd > /home/XXXXXXXX/s0711489/pwd.log"
    "|cat > /home/XXXXXXXX/s0711489/mail.log"
    \s0711489
    
    • mitty -> s0711489 とalias
  • 送信したメール本文 (「@」->「(*)」)
    Date: Sat, 26 Mar 2011 15:19:56 +0900
    From: Ken-ichi Mito <mitty(*)mitty.jp>
    To: mitty(*)coins.tsukuba.ac.jp
    Subject: hoge
    Message-Id: <20110326151951.B1D6.FC51A3C5(*)mitty.jp>
    MIME-Version: 1.0
    Content-Type: text/plain; charset="US-ASCII"
    Content-Transfer-Encoding: 7bit
    
    fuga
    
    -- 
    Ken-ichi Mito <mitty(*)mitty.jp>
    
    .
    
  • ls -> Error return to mitty(*)mitty.jp
    <s0711489(*)coins.tsukuba.ac.jp> (expanded from <mitty(*)coins.tsukuba.ac.jp>):
        Command died with status 1: "ls > hoge". Command output: sh: hoge:
        Permission denied
    
  • id.log
    uid=XXXX(s0711489) gid=YYY(XYZ) groups=ZZZ(XYZ)
    
  • pwd.log
    /var/spool/postfix
    
  • mail.log
    From mitty(*)mitty.jp  Sat Mar 26 15:19:58 2011
    Return-Path: <mitty(*)mitty.jp>
    X-Original-To: mitty(*)coins.tsukuba.ac.jp
    Delivered-To: mitty(*)coins.tsukuba.ac.jp
    
    (snip ... Received: *****)
    
    Date: Sat, 26 Mar 2011 15:19:56 +0900
    From: Ken-ichi Mito <mitty(*)mitty.jp>
    To: mitty(*)coins.tsukuba.ac.jp
    Subject: hoge
    Message-Id: <20110326151951.B1D6.FC51A3C5(*)mitty.jp>
    MIME-Version: 1.0
    Content-Type: text/plain; charset="US-ASCII"
    Content-Transfer-Encoding: 7bit
    
    fuga
    
    --
    Ken-ichi Mito <mitty(*)mitty.jp>
    
    
  • 受信メール
    Return-Path: <mitty(*)mitty.jp>
    X-Original-To: mitty(*)coins.tsukuba.ac.jp
    Delivered-To: mitty(*)coins.tsukuba.ac.jp
    
    (snip ... Received: *****)
    
    Date: Sat, 26 Mar 2011 15:19:56 +0900
    From: Ken-ichi Mito <mitty(*)mitty.jp>
    To: mitty(*)coins.tsukuba.ac.jp
    Subject: hoge
    Message-Id: <20110326151951.B1D6.FC51A3C5(*)mitty.jp>
    MIME-Version: 1.0
    Content-Type: text/plain; charset="US-ASCII"
    Content-Transfer-Encoding: 7bit
    
    fuga
    
    -- 
    Ken-ichi Mito <mitty(*)mitty.jp>
    

設定例

  • .forward
    \s0711489
    "|/usr/bin/procmail || exit 75"
    
  • .procmailrc
    SUBS='(\[coins-)|(\[open-)|(\[word)|(\[ml-tsg)'
    FROM='(word@coins)'
    
    :0 H
    * $ ^Subject:.*$SUBS
    ! mitty(*)mitty.jp
    
    :0 H
    * $ ^From:.*$FROM
    ! mitty(*)mitty.jp
    
  • 全てのメールはローカルにも配送
  • 条件に合致したメールを「mitty (at) mitty.jp」に転送
  • 条件は以下のいずれか
    1. Subjectヘッダに「[coins-」「[open-」「[word」「[ml-tsg」のいずれかが含まれる
    2. Fromヘッダに「word@coins」が含まれる
Last modified 6 years ago Last modified on Apr 28, 2011 11:19:15 PM