#1-
----Begin Snippet----
Version=4.0
Active=1
[HamsterRelay]
1
CFLD00A04From0Froland-liebl.de
CFLD00B09X-MF-Seen03yes
AAFD09X-MF-Seen03yes
AAFD0A!MAIL FROM0B{X-MF-From}
AAFD08!RCPT TO09{X-MF-To}
ASVED:\WebDevelopement\hamster\Mails\Mail.Out\{X-MF-Tickcount}.msg
ADEL
ARUNC:\WINDOWS\system32\wscript.exe¦D:\WebDevelopement\Hamster\Scripts\trigger_smtp.vbs¦5¦1
----End Snippet
Save the code above in /MailFillter/Filters/OnBefore/Default.mfr
EXPLANATION: First the filter checks if sender is in domain "roland-liebl.de". It adds a header field "X-MF:Seen" to avoid message loops. Then it adds two header fealds used by hamster relay service (!MAIL FROM:
me@mydomain.com and !RCPT TO:
you@yourdomain.com). It saves the modified message file in the hamster outbox (Mail.Out).
#2-
Lauch MailFilter Control Panel and edit "roland-liebl.de" to reflect your domain which should be forwarded to your alternate relay.
#3-
Make sure that the path to wscript.exe is pointing to this application; maybe you have to edit the drive and \WINDOWS\ to \WINNT\.
#4-
----Begin Snippet----
'Trigger smtp
'Initialize Hamster-constants
Const HAM_WAITIDLE_INFINITE = 0
'Initialize Hamster-object
'Note: Hamster.exe will be loaded now if does not run already.
Set Hamster = Wscript.CreateObject( "Hamster.App" )
Hamster.ControlRunMail ""
Hamster.ControlWaitIdle HAM_WAITIDLE_INFINITE
'Release Hamster-object
Wscript.DisconnectObject Hamster
----End Snippet
Save the code above as D:\WebDevelopement\Hamster\Scripts\trigger_smtp.vbs. If you want to have it anywhere else, make sure to edit the filter code.
EXPLANATION: The script simply force hamster to purge the outbox (relay mail).
Done! ... Instead of triggering the vbs script by MailFilter, you could schedule the script by the task manager (e.g. every 2 minutes). Maybe it is better for the performance if Hamster is not launched for each email passed to MailFilter.
Enjoy-
Roland
P.S: You won't regret to install Hamster. It is a really good and powerful tool to automate email processing and to realize fancy things!