Hi list.
I'm trying to do my own maildrop script to do forward for outside
mails. I use a ldap attribute to store the mail address to forward. I
was using aliases in postfix, but this is a problem with SPF enabled
domains (SRS problem).
I did the following script to do mail forward:
/^To:.*/
getaddr($MATCH) =~ /^.*/;
MATCH=tolower($MATCH)
`FORWARD=$(ldapsearch -x -b 'ou=People,dc=domain,dc=com'
"(&(uid=$MATCH)(accountStatus=forward))" mailforward | grep
^"mailforward:" | cut -d\: -f2- | cut -d\ -f2- | sed -e
"s/[\\\`\\\\\$\(\)]//g" ) ; \
[ "${FORWARD}" ] && { cat - >/tmp/email_enc_${MATCH}$$.eml ; sendEmail
-q -f post...@domain.com -t ${FORWARD} -u "Forward Message" -a
/tmp/email_enc_${MATCH}$$.eml ; rm -f /tmp/email_enc_${MATCH}$$.eml;
exit 1 ; } `
if ( $RETURNCODE == 0 )
exit
But this script works only when the first "To:" mail address is the
user with forward enabled. If the message has more than one "to:"
address and it's not the first address, then mail forward don't work.
Some tip to get this work ? Any other way to solve mail forward with
SRS problem ?
http://jczucco.blogspot.com