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 I need some help for configuring sendmail to forward emails to another mail server. I am mentioning the details below. 1. When any user sends an email to a particular domain (eg: TO ADDRESS is "abc @ particulardomain.com"), then my sendmail should act as a smart host and forward the request to a different mail server. (Only emails SEND to that specific domain) 2. When a Specific User (From Address: "specifuser @ mydomain.com")sends an email to any address then that also should be forwarded to a different mail server. Can anyone please help me for solving this. Thanks & ...

Go Back   Application Development Forum > Other Technologies > SendMail

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-28-2008, 03:22 AM
biju.blore@gmail.com
Guest
 
Default Fowarding Email Send to a Particular domain

Hi

I need some help for configuring sendmail to forward emails
to another mail server. I am mentioning the details below.

1. When any user sends an email to a particular domain (eg: TO ADDRESS
is "abc@particulardomain.com"), then my sendmail should act as a smart
host and forward the request to a different mail server. (Only emails
SEND to that specific domain)

2. When a Specific User (From Address: "specifuser@mydomain.com")sends
an email to any address then that also should be forwarded to a
different mail server.

Can anyone please help me for solving this.

Thanks & Regards,
Biju
Reply With Quote
  #2  
Old 08-28-2008, 10:40 AM
Grant Taylor
Guest
 
Default Re: Fowarding Email Send to a Particular domain

On 08/28/08 02:22, biju.blore@gmail.com wrote:
> 1. When any user sends an email to a particular domain (eg: TO
> ADDRESS is "abc@particulardomain.com"), then my sendmail should act
> as a smart host and forward the request to a different mail server.
> (Only emails SEND to that specific domain)


If you are truly needing "this domain goes here" (despite what MX
records say) you can easily do this with MailerTable.

> 2. When a Specific User (From Address: "specifuser@mydomain.com")
> sends an email to any address then that also should be
> forwarded to a different mail server.


Are you saying that when you are relaying email from your user base you
want to SmartHost out through said server (from MailerTable above) when
the sender is from the domain in question no matter who the recipient
domain(s) is (are)?



Grant. . . .

Reply With Quote
  #3  
Old 08-28-2008, 08:31 PM
biju.blore@gmail.com
Guest
 
Default Re: Fowarding Email Send to a Particular domain

On Aug 29, 12:40 am, Grant Taylor <gtay...@riverviewtech.net> wrote:
> On 08/28/08 02:22, biju.bl...@gmail.com wrote:
>
> > 1. When any user sends an email to a particular domain (eg: TO
> > ADDRESS is "a...@particulardomain.com"), then my sendmail should act
> > as a smart host and forward the request to a different mail server.
> > (Only emails SEND to that specific domain)

>
> If you are truly needing "this domain goes here" (despite what MX
> records say) you can easily do this with MailerTable.
>
> > 2. When a Specific User (From Address: "specifu...@mydomain.com")
> > sends an email to any address then that also should be
> > forwarded to a different mail server.

>
> Are you saying that when you are relaying email from your user base you
> want to SmartHost out through said server (from MailerTable above) when
> the sender is from the domain in question no matter who the recipient
> domain(s) is (are)?
>
> Grant. . . .


Hi Grant

Thanks a lot for the information.
Whatever you told for my second question is true.

what ever emails a specific user (user1@mydomain.com) is sending, all
those emails (no matter who all are the recepients) should be
forwarded by my email server to another email server (all permissions
are there for me in the second email server)

Also Grant i have one more question.

1. IF any user is sending emails to anyone with a SPECIFIC SUBJECT or
a SPECIFIC UNIQUE STRING in the BODY, my email server should forward
such emails to the another email server (ONLY EMAILS WITH SPECIFIC
SUBJECTS OR UNIQUES STRING IN THE BODY should be forwarded),
rest all emails should use my email server for sending. Is there any
way to do this, by writing a rule set or so?

Thanks & Regards,
Biju


Reply With Quote
  #4  
Old 08-28-2008, 10:47 PM
Grant Taylor
Guest
 
Default Re: Fowarding Email Send to a Particular domain

On 8/28/2008 7:31 PM, biju.blore@gmail.com wrote:
> Thanks a lot for the information.


You are welcome.

> Whatever you told for my second question is true.
>
> what ever emails a specific user (user1@mydomain.com) is sending, all
> those emails (no matter who all are the recepients) should be
> forwarded by my email server to another email server (all permissions
> are there for me in the second email server)


Ok...

> Also Grant i have one more question.
>
> 1. IF any user is sending emails to anyone with a SPECIFIC SUBJECT or
> a SPECIFIC UNIQUE STRING in the BODY, my email server should forward
> such emails to the another email server (ONLY EMAILS WITH SPECIFIC
> SUBJECTS OR UNIQUES STRING IN THE BODY should be forwarded), rest all
> emails should use my email server for sending. Is there any way to do
> this, by writing a rule set or so?


Are you wanting this new re-routing based on Subject / Body content to
be in addition to your previous question(s)?

Either way it sounds like you are wanting to conditionally alter the
server the message is sent to, be it by sender and / or subject content
and / or or body content. (This on top of the MailerTable capability.)

I'm not sure how to go about what you are wanting to do. I think you
are going to have to use a milter to alter the ""relay (where Sendmail
sends the message to). Presuming that this can be done (others on this
list can better help you here) you will need to write a milter (or some
Perl for MIMEDefang) to conditionally do this for you.

I will be very surprised if stock Sendmail can touch the later part(s)
of your request with out the help of a milter or some serious customization.



Grant. . . .

Reply With Quote
  #5  
Old 08-29-2008, 01:08 AM
biju.blore@gmail.com
Guest
 
Default Re: Fowarding Email Send to a Particular domain

On Aug 29, 12:47 pm, Grant Taylor <gtay...@riverviewtech.net> wrote:
> On 8/28/2008 7:31 PM, biju.bl...@gmail.com wrote:
>
> > Thanks a lot for the information.

>
> You are welcome.
>
> > Whatever you told for my second question is true.

>
> > what ever emails a specific user (us...@mydomain.com) is sending, all
> > those emails (no matter who all are the recepients) should be
> > forwarded by my email server to another email server (all permissions
> > are there for me in the second email server)

>
> Ok...
>
> > Also Grant i have one more question.

>
> > 1. IF any user is sending emails to anyone with a SPECIFIC SUBJECT or
> > a SPECIFIC UNIQUE STRING in the BODY, my email server should forward
> > such emails to the another email server (ONLY EMAILS WITH SPECIFIC
> > SUBJECTS OR UNIQUES STRING IN THE BODY should be forwarded), rest all
> > emails should use my email server for sending. Is there any way to do
> > this, by writing a rule set or so?

>
> Are you wanting this new re-routing based on Subject / Body content to
> be in addition to your previous question(s)?
>
> Either way it sounds like you are wanting to conditionally alter the
> server the message is sent to, be it by sender and / or subject content
> and / or or body content. (This on top of the MailerTable capability.)
>
> I'm not sure how to go about what you are wanting to do. I think you
> are going to have to use a milter to alter the ""relay (where Sendmail
> sends the message to). Presuming that this can be done (others on this
> list can better help you here) you will need to write a milter (or some
> Perl for MIMEDefang) to conditionally do this for you.
>
> I will be very surprised if stock Sendmail can touch the later part(s)
> of your request with out the help of a milter or some serious customization.
>
> Grant. . . .



Hi

Thanks for the information Grant

Actually I tried writing a rule set. anyway i was able to filter based
on the subject. But i am not sure how to forward such filtered mail to
another SMTP Server.
I did some thing like below

LOCAL_CONFIG
LOCAL_RULESETS
HSubject: $>Check_Subject
SCheck_Subject
R$*CRAZY $#error $: "Mails with the subject CRAZY is
Rejected"

I was just testing to find if the email send to anyone with the
subject "CRAZY" is rejected and this worked fine.
so that means the subject is filtered.
Now i am thinking how to forward the same to a different mail server
Instead of "$#error" I tried

$#smtp $@ anothermailserver.com

But didnt get through. Is there any way to write a rule set to forward
emails to another mail server
Please do help


Regards
Biju




Reply With Quote
  #6  
Old 08-29-2008, 01:31 PM
Kari Hurtta
Guest
 
Default Re: Fowarding Email Send to a Particular domain

biju.blore@gmail.com writes in comp.mail.sendmail:

> Thanks for the information Grant
>
> Actually I tried writing a rule set. anyway i was able to filter based
> on the subject. But i am not sure how to forward such filtered mail to
> another SMTP Server.
> I did some thing like below
>
> LOCAL_CONFIG
> LOCAL_RULESETS
> HSubject: $>Check_Subject
> SCheck_Subject
> R$*CRAZY $#error $: "Mails with the subject CRAZY is
> Rejected"
>
> I was just testing to find if the email send to anyone with the
> subject "CRAZY" is rejected and this worked fine.
> so that means the subject is filtered.
> Now i am thinking how to forward the same to a different mail server
> Instead of "$#error" I tried
>
> $#smtp $@ anothermailserver.com
>
> But didnt get through. Is there any way to write a rule set to forward
> emails to another mail server
> Please do help
>
>
> Regards
> Biju


Use storage -map to store result of Check_Subject -ruleset to macro
and use that macro on ruleset 0 (or ruleset called from ruleset 0).

You may want register macro name to $={persistentMacros} class,
so that it is preserved on queued mail.

/ Kari Hurtta

(doc/op/op.me)
__________________________________________________ _________

+‐‐‐+
‐‐>| 0 |‐‐>resolved address
/ +‐‐‐+
/ +‐‐‐+ +‐‐‐+
/ ‐‐‐‐>| 1 |‐‐>| S |‐‐
+‐‐‐+ / +‐‐‐+ / +‐‐‐+ +‐‐‐+ \ +‐‐‐+
addr‐‐>| 3 |‐‐>| D |‐‐ ‐‐‐>| 4 |‐‐>msg
+‐‐‐+ +‐‐‐+ \ +‐‐‐+ +‐‐‐+ / +‐‐‐+
‐‐‐>| 2 |‐‐>| R |‐‐
+‐‐‐+ +‐‐‐+

Figure 1 — Rewriting set semantics
D — sender domain addition
S — mailer‐specific sender rewriting
R — mailer‐specific recipient rewriting
__________________________________________________ __________


Reply With Quote
  #7  
Old 08-29-2008, 09:59 PM
Per Hedeland
Guest
 
Default Re: Fowarding Email Send to a Particular domain

In article <5dod3bpw2a.fsf@Hurtta06k.keh.iki.fi> Kari Hurtta
<hurtta+comp.mail.sendmail@siilo.fmi.fi> writes:
>
>Use storage -map to store result of Check_Subject -ruleset to macro
>and use that macro on ruleset 0 (or ruleset called from ruleset 0).


Surely this doesn't work unless you use DeliveryMode=queue (and
$={persistentMacros}) - S0 is processed and the routing decision(s)
taken before the headers are seen.

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

On Aug 30, 11:59 am, p...@hedeland.org (Per Hedeland) wrote:
> In article <5dod3bpw2a....@Hurtta06k.keh.iki.fi> Kari Hurtta
>
> <hurtta+comp.mail.sendm...@siilo.fmi.fi> writes:
>
> >Use storage -map to store result of Check_Subject -ruleset to macro
> >and use that macro on ruleset 0 (or ruleset called from ruleset 0).

>
> Surely this doesn't work unless you use DeliveryMode=queue (and
> $={persistentMacros}) - S0 is processed and the routing decision(s)
> taken before the headers are seen.
>
> --Per Hedeland
> p...@hedeland.org


Hi Karri & Per

Thanks a lot for the informations. I tried to write the rule sets
as per your email, which i am mentioning below. I am not sure if this
is the way, that you actually told.

LOCAL_CONFIG
Kstorage macro
HSubject: $>Check_Subject
C{persistentMacros} {subj_exist}
LOCAL_RULESETS
SCheck_Subject
R$*CRAZY $: $(storage {subj_exist} $@ YES $) $1
Scheck_eoh
R$* $: < $&{subj_exist} >
R$* $: $(storage {subj_exist} $) $1
R<YES> $#error $: "Mails with the subject CRAZY is
Rejected"

I changed the value of "O DeliveryMode=background" to "O
DeliveryMode=queue" in sendmail.cf

This worked fine. But i am not sure how to use $#smtp.
Can you please have a look on the above rule set, and please tell me
if this is the way that you suggested and if so how to forward the
email with subject "CRAZY" to another email server. If this is not the
way the rule set is to be written, pls can you rectify the same

Thanks & Regards,]
Biju
Reply With Quote
  #9  
Old 09-03-2008, 03:54 PM
Per Hedeland
Guest
 
Default Re: Fowarding Email Send to a Particular domain

In article
<302ca313-6213-4099-964b-8f8989415019@w7g2000hsa.googlegroups.com>
biju.blore@gmail.com writes:
>
> Thanks a lot for the informations. I tried to write the rule sets
>as per your email, which i am mentioning below. I am not sure if this
>is the way, that you actually told.
>
>LOCAL_CONFIG
>Kstorage macro
>HSubject: $>Check_Subject
>C{persistentMacros} {subj_exist}
>LOCAL_RULESETS
>SCheck_Subject
>R$*CRAZY $: $(storage {subj_exist} $@ YES $) $1
>Scheck_eoh
>R$* $: < $&{subj_exist} >
>R$* $: $(storage {subj_exist} $) $1
>R<YES> $#error $: "Mails with the subject CRAZY is
>Rejected"


Seems OK (I assume your check_eoh ruleset is just for testing).

>I changed the value of "O DeliveryMode=background" to "O
>DeliveryMode=queue" in sendmail.cf


You can do this from .mc with confDELIVERY_MODE (and I assume you
realize that it means that all mail will be queued and sent/delivered
only on queue runs).

>This worked fine. But i am not sure how to use $#smtp.
>Can you please have a look on the above rule set, and please tell me
>if this is the way that you suggested and if so how to forward the
>email with subject "CRAZY" to another email server.


Custom routing rules go in LOCAL_RULE_0 in your .mc. Something like this
might work:

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

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

Hi Per,

Thanks a lot for the information. That was really terrific and
it did the job.
I did the end of headers check for testing and i was not at all sure
how to do the routing using Rule Set 0
Once again thanks a lot for this

Cheers
Biju
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:51 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.