filtering/process inbound email

Rick Stevens rstevens at vitalstream.com
Fri May 6 21:42:00 UTC 2005


karlp at ourldsfamily.com wrote:
> Scenario:  At work, we use RH9/sendmail. We autofax documents from our
> business system via modem. The software also can use email and
> occasionally when an email fails, it is returned to the fax server 'user'
> which is aliased to me.
> 
> There is a line in the email that says Submitted by: user
> 
> Is there a relatively easy way to parse any incoming/bounced email sent to
> the fax server's email address and forward email to user?

You could add a rule to /etc/procmailrc (or ~fax/.procmailrc) to parse
and forward it.  Assuming the fax account's username is "fax" and that
"fax" is aliased to you, how about something like this in your
$HOME/.procmailrc:

	:0
	* ^To:.fax			# Was it sent to "fax" AND
	* ^Submitted by:.*		# Does it contain "Submitted"?
	{
	    :0 fhw			# Yes, parse rest
	    * ^Submitted by: \/[^ ]*	# Pick up who sent the job
	    ! $MATCH			# Forward the mail to them.
	}

That should pick up any mail addressed to the user "fax" that also
includes "Submitted by:"  and forward it to whatever user is specified
in the "Submitted by:" line.

I won't vouch that this exact script works, but the concept is sound.
See "man procmailrc" and "man procmailex" for details on recipes.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-      Always remember you're unique, just like everyone else.       -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list