将我的学院邮件转发到 Gmail?

将我的学院邮件转发到 Gmail?

我想将我学院邮件中的电子邮件转发到我的 gmail,同时将原件也保留在学院帐户中。我尝试编辑我的/.procmail文件,如下所示:

# Forward everything to me at gmail
:0:
! [email protected]

这工作正常,只是原始邮件只是退回到 Gmail 帐户,而不是存储在学院邮件帐户中。为此该怎么办?

答案1

用于:0c转发消息的副本

:0c
! [email protected]

c 标志文档:

c    Generate  a  carbon  copy  of this mail.  This only makes sense on delivering recipes.  The only
        non-delivering recipe this flag has an effect on is on a nesting block, in order to  generate  a
        carbon  copy  this  will  clone  the running procmail process (lockfiles will not be inherited),
        whereby the clone will proceed as usual and the parent will jump across the block.

答案2

我从中得到了一个方法关联。但不知道有没有什么陷阱。

SENDMAIL=/usr/sbin/sendmail
FROM_=`formail -c -I"Reply-To:" -rt -xTo: \
  | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
SUBJ_=`formail -xSubject: \
       | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`

# Make a copy of all email to my second address
:0
* ! ^X-Loop: myid@myhost\.mydom
{
  :0c:${HOME}/procmail.lock
  | formail -A"X-Loop: [email protected]" \
    -I"Subject: ${SUBJ_} [autofwd]" \
    | ${SENDMAIL} -f"${FROM_}" [email protected]
}

相关内容