Fowarding Email Send to a Particular domain

This is a discussion on Fowarding Email Send to a Particular domain within the SendMail forums in Other Technologies category; Hi Per, I am sending this mail seeking some more help from your side. The Ruleset used in my sendmail configuration is something as shown below and this works fine for whatever i was planning for. This works in the following way. If the From address is ("mailuser1" or "mailuser2") AND the subject is "crazyboy" then the mail is forwarded to "mail.testext.com" For all other users with the same subject ("crazyboy") or any other subject OR For the same users (mailuser1 & mailuser2) with any different subject then the mail is NOT forwarded to "mail.testext.com" and the mails are send ...

Go Back   Application Development Forum > Other Technologies > SendMail

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #11  
Old 09-05-2008, 04:02 AM
biju.blore@gmail.com
Guest
 
Default Re: Fowarding Email Send to a Particular domain

Hi Per,

I am sending this mail seeking some more help from your side.

The Ruleset used in my sendmail configuration is something as shown
below and this works fine for whatever i was planning for. This works
in the following way.

If the From address is ("mailuser1" or "mailuser2") AND the subject is
"crazyboy" then the mail is forwarded to "mail.testext.com"

For all other users with the same subject ("crazyboy") or any other
subject OR For the same users (mailuser1 & mailuser2) with any
different subject
then the mail is NOT forwarded to "mail.testext.com" and the mails are
send via the local mail server.

And all things works fine. Now i have an additional task to be
achieved in this. But i am not sure how to.


The requirement is "If any user other than "mailuser1" and "mailuser2"
sends an email to anyone with the subject "crazyboy" then instead of
sending the email via the local mail server, an error should pop up
(something like "pls don't use the subject crazyboy"). (If the user
uses a different subject, the mail should be send by the local mail
server as it is working now. Only if the From address is : "mailuser1"
or "mailuser2" AND subject is "crazyboy" the error should pop up)



LOCAL_CONFIG
Kstorage macro
HSubject: $>Check_Subject
HFrom: $>Check_From
C{persistentMacros} {subj_exist}
C{persistentMacros} {from_exist}
LOCAL_RULESETS
SCheck_From
R$* $: $| $>canonify $1
R$*$|mailuser1 $+ $* $: $(storage {from_exist} $@ YES $) $|mailuser1
$2 $3
R$*$|mailuser2 $+ $* $: $(storage {from_exist} $@ YES $) $|mailuser2
$2 $3
SCheck_Subject
R$*CRAZYBOY $* $: $(storage {subj_exist} $@ YES $) $1 CRAZYBOY
$2
LOCAL_RULE_0
R$* $: $1 $|$&{subj_exist} check macro
R$*$|YES $: $1 $|$&{from_exist} check macro
R$*$|YES $#esmtp $@mail.testext.com.$: $1 match, reroute
R$*$|$*
$1 no
match



Can you please help me for achieving this.


Thanks & Regards,
Biju
Reply With Quote
  #12  
Old 09-08-2008, 06:20 PM
Per Hedeland
Guest
 
Default Re: Fowarding Email Send to a Particular domain

In article
<ecc99331-eb5f-4281-a859-14df2814c3ad@m36g2000hse.googlegroups.com>
biju.blore@gmail.com writes:

>The Ruleset used in my sendmail configuration is something as shown
>below and this works fine for whatever i was planning for. This works
>in the following way.
>
>If the From address is ("mailuser1" or "mailuser2") AND the subject is
>"crazyboy" then the mail is forwarded to "mail.testext.com"


I doubt that you have a requirement to check the From: *header* -
checking the envelope sender address (available as $&f) makes things
simpler (and the envelope sender is marginally less trivial to spoof).

>The requirement is "If any user other than "mailuser1" and "mailuser2"
>sends an email to anyone with the subject "crazyboy" then instead of
>sending the email via the local mail server, an error should pop up


Sendmail won't pop up anything.:-) At best you can get a reject at
end-of-message (you need to receive the message to see the Subject).
Something like the below might work (completely untested). Since you are
rejecting everyone else, you don't need to check the sender again in
LOCAL_RULE_0.

LOCAL_CONFIG
Kstorage macro
HSubject: $>Check_Subject
C{persistentMacros} {subj_exist}
C{ValidUsers} mailuser1 mailuser2

LOCAL_RULESETS
SCheck_Subject
R$* CRAZYBOY $* $: $(storage {subj_exist} $@ YES $) $&f $| $1 CRAZYBOY $2
R< $={ValidUsers} @ $* > $| $* $: $3
R$* $| $* $#error $: "553 Pls don't use the subject crazyboy"

LOCAL_RULE_0
R$* $: $1 $|$&{subj_exist} check macro
R$*$|YES $#esmtp $@mail.testext.com.$: $1 match, reroute
R$*$|$* $1 no match


--Per Hedeland
per@hedeland.org
Reply With Quote
  #13  
Old 09-09-2008, 02:04 AM
biju.blore@gmail.com
Guest
 
Default Re: Fowarding Email Send to a Particular domain

Hi Per,
Thanks a lot for the information. I tried the rulesets, but
unfortunately, its behaving in a weird manner.
ie Any emails from any user (including the users in the valid users
class) with subject "crazyboy" is rejected.
I tried to sort it out, but so far no success. can you please have a
look
I

> LOCAL_RULE_0.
>
> LOCAL_CONFIG
> Kstorage macro
> HSubject: $>Check_Subject
> C{persistentMacros} {subj_exist}
> C{ValidUsers} mailuser1 mailuser2
>
> LOCAL_RULESETS
> SCheck_Subject
> R$* CRAZYBOY $* $: $(storage {subj_exist} $@ YES $) $&f $| $1 CRAZYBOY $2
> R< $={ValidUsers} @ $* > $| $* $: $3
> R$* $| $* $#error $: "553 Pls don't use the subject crazyboy"
>
> LOCAL_RULE_0
> R$* $: $1 $|$&{subj_exist} check macro
> R$*$|YES $#esmtp $...@mail.testext.com.$: $1 match, reroute
> R$*$|$* $1 no match
>


Regards
Biju
Reply With Quote
  #14  
Old 09-10-2008, 05:23 PM
Per Hedeland
Guest
 
Default Re: Fowarding Email Send to a Particular domain

In article
<e9adfbb1-40c8-44ba-ae96-8353f618dcf6@k7g2000hsd.googlegroups.com>
biju.blore@gmail.com writes:
> Thanks a lot for the information. I tried the rulesets, but
>unfortunately, its behaving in a weird manner.
>ie Any emails from any user (including the users in the valid users
>class) with subject "crazyboy" is rejected.


Untested sendmail rewrite rules failing to do what they're supposed to
do isn't "weird", it's expected.:-) Strange though, I seem to remember
that $&f should be exactly as given to sendmail, i.e. include the
surrounding <brackets> in case of SMTP, but that's not the case. More
robust rules (actually tested!):

LOCAL_RULESETS
SCheck_Subject
R$* CRAZYBOY $* $: $(storage {subj_exist} $@ YES $) $1 CRAZYBOY $2 $| $>canonify $&f
R$* $| $={ValidUsers} < @ $* > $: $1
R$* $| $* $#error $: "553 Pls don't use the subject crazyboy"


--Per Hedeland
per@hedeland.org
Reply With Quote
  #15  
Old 09-10-2008, 11:18 PM
biju.blore@gmail.com
Guest
 
Default Re: Fowarding Email Send to a Particular domain

Hi Per,

Thanks a lot..That worked..
Now i got the mistakes i made when trying to debug the previous rule
set..
so i learned from the mistakes and this will help me in my further
tests
Anyway Thanks a lot for helping me in this regard

Cheers
Biju
Reply With Quote
  #16  
Old 09-26-2008, 01:20 AM
biju.blore@gmail.com
Guest
 
Default Re: Fowarding Email Send to a Particular domain


Hi Per,

I need a Some more help regarding the subject based mail forwarding
rule set.

Case 1:
---------------
My Ruleset is as follows. In this Rule Set i am also checking the
"message id" and "From" address of my outgoing mail other than the
"subject".

LOCAL_CONFIG
Kstorage macro
HSubject: $>Check_Subject
HMessage-ID: $>Check_MessageId
F{ValidUsers} /etc/mail/checkuser
C{persistentMacros} {sub_ex}
C{persistentMacros} {msg_ex}
LOCAL_RULESETS
SCheck_MessageId
R< $+ @ $* testint.com> $: $
(storage {msg_ex} $@ YES $) < $1 @ $2 testint.com >
SCheck_Subject
R$* crazy $* $: $
(storage {sub_ex} $@ YES $) $1 $2 $|$&{msg_ex}$|$>canonify $&f
R$*$|YES$|$={ValidUsers} < @ testext.com . > $: $1
R$*$|YES$|$*
$#error $@ 5.3.0 $: "553 Pls don't use the subject crazy"
LOCAL_RULE_0
R$*
$: $1 $|$&{sub_ex}$|
$&{msg_ex} check macro
R$*$|YES$|YES $#esmtp
$@[mail.testext.com.]$: $1 match,
reroute
R$*$|$*$|$*
$1
no match



My intention was as follows

1. If message id is "testint.com" and subject is the word "crazy"
and if it is from the list of "valid users" then the
message should be forwarded

2. If message id is "testint.com" and subject is the word "crazy"
and if it is NOT from the list of "valid users" then the
message should be rejected

3. If message id is "testint.com" and subject is "ANYTHING" and if
it IS/NOT from the list of "valid users" it should
NOT be Forwarded and should be delivered locally.

4. If message id is "Anything" and the subject is the word "crazy"
and if it IS/NOT from the list of "valid users" it
should NOT be Forwarded and should be delivered locally.

5. If message id is "Anything" and the subject is "Anything" and if
it IS/NOT from the list of "valid users" it should
NOT be Forwarded and should be delivered locally.


All the above (1 - 5) tests worked perfectly when i was using a
Mozilla Thunderbird as email client and Netscape as
Email Client.

In this case an error window popped up with the message "5.3.0 $:
"553 Pls don't use the subject crazy". (This was
in a pop up window, Not an error delivery failure email)

The problem happened when i tried all these tests using MS Outlook
as email client. Here the problem was with Test
No 2.

All other tests were successful. That is as per Test No 2, the
error/mail delivery failure email was not happening.
When trying Test No 2, I found that the mail was forwarded rather
than returning any mail delivery error.

Case 2:
--------------

So I tried another rule set just to test if "$#error" is returning
an error mail to the outlook. The rule set is mentioned below. This
rule set does force encryption if the mail is send from the client
without Encryption. (I got help from you 1.5 years back for this rule
set)


LOCAL_CONFIG
C{ClearTextIP}127.0.0.1
LOCAL_RULESETS
SLocal_check_rcpt
R$* $: $| $>canonify $1
R$| $* $: $&{client_addr}
R$@ $@ OK
R$* $: $&{alg_bits}
R$@ $#error $@ 5.7.1 $: "Encryption
Required"
R$* $@ OK


This worked perfectly with MS outlook. When i tried to send an email
without encryption, i got delivery failure error MAIL send from the
"System administrator" account with the message "Encryption
Required".

When i tried the same in Mozilla Thunderbird email client and Netscape
i got the same delivery error MAIL rather than a pop up window
( Note: In the first case (case 1) i got a pop up window with the
error message when using Thunderbird and
Netscape as email client)


Can you please help me to make "Case 1 - Test 2" successful when using
MS outlook as Email Client
I wrote this huge mail for explaining all that happened.

Thanks & Regards,
Biju

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:46 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.