Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Qmail: users

how to process an email based on domain name

 

 

Qmail users RSS feed   Index | Next | Previous | View Threaded


vadud3 at gmail

Jul 5, 2008, 9:18 AM

Post #1 of 8 (587 views)
Permalink
how to process an email based on domain name

Hi

I am looking for a way to do the following.

Pseudo code:

if domain name of the sender is domain.com then process it through the
following block of lines and exit

|822field x-spam-status | egrep -iw yes >/dev/null && exit 100 || exit 0
|822field from | egrep -i "MAILER-DAEMON|POSTMASTER|ABUSE" >/dev/null &&
exit 100 || exit 0
|822field to | egrep -i "MAILER-DAEMON|POSTMASTER|ABUSE" >/dev/null &&
exit 100 || exit 0
|822field cc | egrep -i "MAILER-DAEMON|POSTMASTER|ABUSE" >/dev/null &&
exit 100 || exit 0
|822field return-path | egrep -i "MAILER-DAEMON|POSTMASTER|ABUSE"
>/dev/null && exit 100 || exit 0
|/opt/rt3/bin/rt-mailgate --queue help --action correspond --url
https://help.domain.net 2>/dev/null || exit 111

otherwise reply to the sender with the following autoresponder

|/var/qmail/local/bin/autorespond 600 10 autoresponder/sorry
autoresponder/log


So we are going to accept RT ticket request *only* from `domain.com'. Any
request
that comes from any other domains will get a auto respond to send their
request to some other address


--
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu


jms1 at jms1

Jul 7, 2008, 11:44 AM

Post #2 of 8 (527 views)
Permalink
Re: how to process an email based on domain name [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2008-07-05, at 1218, Asif Iqbal wrote:
>
> I am looking for a way to do the following.
>
> ...

write a script which does that, and make the appropriate .qmail-* file
point to that script.

> So we are going to accept RT ticket request *only* from
> `domain.com'. Any request that comes from any other domains will get
> a auto respond to send their request to some other address

i'm sure any number of people, myself included, would be able to write
you a simple script like this, in exchange for an appropriate fee.

otherwise, the information you need in order to build such a script
can be found in qmail's documentation, along with any beginner-level
book on shell or perl scripting.

- --------------------------------------------------------
| John M. Simpson -- KG4ZOW -- Programmer At Large |
| http://www.jms1.net/ <jms1[at]jms1.net> |
- --------------------------------------------------------
| Hope for America -- http://www.ronpaul2008.com/ |
- --------------------------------------------------------





-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkhyY/4ACgkQEB9RczMG/PujTQCg9XXWpUvA3zdQRQt4Tl6U4rPc
eBgAoOU2YSQw6Ch+vdaR8fW7Wwv7sIkN
=awX5
-----END PGP SIGNATURE-----


vadud3 at gmail

Jul 8, 2008, 10:27 AM

Post #3 of 8 (514 views)
Permalink
Re: how to process an email based on domain name [In reply to]

On Mon, Jul 7, 2008 at 2:44 PM, John Simpson <jms1[at]jms1.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 2008-07-05, at 1218, Asif Iqbal wrote:
>
>>
>> I am looking for a way to do the following.
>>
>> ...
>>
>
> write a script which does that, and make the appropriate .qmail-* file
> point to that script.
>
> So we are going to accept RT ticket request *only* from `domain.com'.
>> Any request that comes from any other domains will get a auto respond to
>> send their request to some other address
>>
>
> i'm sure any number of people, myself included, would be able to write you
> a simple script like this, in exchange for an appropriate fee.
>

Absolutely no doubt. You are right on money ;-)

Thanks for being soo helpful



>
> otherwise, the information you need in order to build such a script can be
> found in qmail's documentation, along with any beginner-level book on shell
> or perl scripting.


> - --------------------------------------------------------
> | John M. Simpson -- KG4ZOW -- Programmer At Large |
> | http://www.jms1.net/ <jms1[at]jms1.net> |
> - --------------------------------------------------------
> | Hope for America -- http://www.ronpaul2008.com/ |
> - --------------------------------------------------------
>
>
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.8 (Darwin)
>
> iEYEARECAAYFAkhyY/4ACgkQEB9RczMG/PujTQCg9XXWpUvA3zdQRQt4Tl6U4rPc
> eBgAoOU2YSQw6Ch+vdaR8fW7Wwv7sIkN
> =awX5
> -----END PGP SIGNATURE-----
>



--
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu


vadud3 at gmail

Jul 9, 2008, 5:39 PM

Post #4 of 8 (503 views)
Permalink
Re: how to process an email based on domain name [In reply to]

On Sat, Jul 5, 2008 at 12:18 PM, Asif Iqbal <vadud3[at]gmail.com> wrote:

> Hi
>
> I am looking for a way to do the following.
>
> Pseudo code:
>
> if domain name of the sender is domain.com then process it through the
> following block of lines and exit
>
> |822field x-spam-status | egrep -iw yes >/dev/null && exit 100 || exit 0
> |822field from | egrep -i "MAILER-DAEMON|POSTMASTER|ABUSE" >/dev/null &&
> exit 100 || exit 0
> |822field to | egrep -i "MAILER-DAEMON|POSTMASTER|ABUSE" >/dev/null &&
> exit 100 || exit 0
> |822field cc | egrep -i "MAILER-DAEMON|POSTMASTER|ABUSE" >/dev/null &&
> exit 100 || exit 0
> |822field return-path | egrep -i "MAILER-DAEMON|POSTMASTER|ABUSE"
> >/dev/null && exit 100 || exit 0
> |/opt/rt3/bin/rt-mailgate --queue help --action correspond --url
> https://help.domain.net 2>/dev/null || exit 111
>
> otherwise reply to the sender with the following autoresponder
>
> |/var/qmail/local/bin/autorespond 600 10 autoresponder/sorry
> autoresponder/log
>
>
> So we are going to accept RT ticket request *only* from `domain.com'. Any
> request
> that comes from any other domains will get a auto respond to send their
> request to some other address
>
>
I am still looking for some other suggestions.

Thanks



>
> --
> Asif Iqbal
> PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
>
>
>


--
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu


search-web-for-address at pyropus

Jul 9, 2008, 9:40 PM

Post #5 of 8 (494 views)
Permalink
Re: how to process an email based on domain name [In reply to]

Asif Iqbal <vadud3[at]gmail.com> wrote:
> >
> I am still looking for some other suggestions.

Why? You already received the correct answer. If you think it won't work,
you need to explain why. Otherwise you're just wasting everyone's time here.

Charles
--
--------------------------------------------------------------------------
Charles Cazabon
GPL'ed software available at: http://pyropus.ca/software/
Read http://pyropus.ca/personal/writings/12-steps-to-qmail-list-bliss.html
--------------------------------------------------------------------------


vadud3 at gmail

Dec 3, 2008, 1:17 PM

Post #6 of 8 (18 views)
Permalink
Re: how to process an email based on domain name [In reply to]

On Mon, Jul 7, 2008 at 1:44 PM, John Simpson <jms1[at]jms1.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 2008-07-05, at 1218, Asif Iqbal wrote:
>>
>> I am looking for a way to do the following.
>>
>> ...
>
> write a script which does that, and make the appropriate .qmail-* file point
> to that script.

So I wrote this

if [[ $(< /etc/domainlist) = *${SENDER##*@}* ]]
then
exit 0
else
qmail-autoresponder -c -n 2 -t 60 /var/qmail/alias/AUTORESPONDS.DNS
exit 99
fi

It basically receives and checks domain name of the sender. If it
matches to the list
/etc/domainlist then exit with with 0 or it notifies the customer
with necessary instructions
of any changes and then exit out with 99.

Now it works just fine. However, it won't scale well if the domainlist
grows to say few thousands.

Looking for suggestion in how to convert it to CDB and then lookup
against that OR some rblsmtpd
trick.

Thanks


>
>> So we are going to accept RT ticket request *only* from `domain.com'. Any
>> request that comes from any other domains will get a auto respond to send
>> their request to some other address
>
> i'm sure any number of people, myself included, would be able to write you a
> simple script like this, in exchange for an appropriate fee.
>
> otherwise, the information you need in order to build such a script can be
> found in qmail's documentation, along with any beginner-level book on shell
> or perl scripting.
>
> - --------------------------------------------------------
> | John M. Simpson -- KG4ZOW -- Programmer At Large |
> | http://www.jms1.net/ <jms1[at]jms1.net> |
> - --------------------------------------------------------
> | Hope for America -- http://www.ronpaul2008.com/ |
> - --------------------------------------------------------
>
>
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.8 (Darwin)
>
> iEYEARECAAYFAkhyY/4ACgkQEB9RczMG/PujTQCg9XXWpUvA3zdQRQt4Tl6U4rPc
> eBgAoOU2YSQw6Ch+vdaR8fW7Wwv7sIkN
> =awX5
> -----END PGP SIGNATURE-----
>



--
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu


kyle-qmail at memoryhole

Dec 3, 2008, 3:17 PM

Post #7 of 8 (18 views)
Permalink
Re: how to process an email based on domain name [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday, December 3 at 04:17 PM, quoth Asif Iqbal:
>It basically receives and checks domain name of the sender. If it
>matches to the list
> /etc/domainlist then exit with with 0 or it notifies the customer
>with necessary instructions
>of any changes and then exit out with 99.

>Looking for suggestion in how to convert it to CDB and then lookup
>against that

That's easy. Use cdbmake. (http://cr.yp.to/cdb/cdbmake.html). You'd
create a data file like so:

+11,1:example.com->1
+13,1:elsewhere.com->1

Then build it into a cdb:

cdbmake domainlist.cdb domainlist.cdb.tmp < datafile

Then you check the database with cdbget
(http://cr.yp.to/cdb/cdbget.html), like so:

cdbget suspiciousdomain.com < domainlist.cdb

~Kyle
- --
It was luxuries like air conditioning that brought down the Roman
Empire. With air conditioning their windows were shut, they couldn’t
hear the barbarians coming.
-- Garrison Keillor
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iEYEARECAAYFAkk3E50ACgkQBkIOoMqOI15oyQCgjufFFxVDILnzPlejR4qT8fRO
npoAoLTorPm2H41JkG3+KvYesa0L2lyO
=p6CC
-----END PGP SIGNATURE-----


vadud3 at gmail

Dec 3, 2008, 6:28 PM

Post #8 of 8 (13 views)
Permalink
Re: how to process an email based on domain name [In reply to]

On Wed, Dec 3, 2008 at 6:17 PM, Kyle Wheeler <kyle-qmail[at]memoryhole.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Wednesday, December 3 at 04:17 PM, quoth Asif Iqbal:
>>It basically receives and checks domain name of the sender. If it
>>matches to the list
>> /etc/domainlist then exit with with 0 or it notifies the customer
>>with necessary instructions
>>of any changes and then exit out with 99.
>
>>Looking for suggestion in how to convert it to CDB and then lookup
>>against that
>
> That's easy. Use cdbmake. (http://cr.yp.to/cdb/cdbmake.html). You'd
> create a data file like so:
>
> +11,1:example.com->1
> +13,1:elsewhere.com->1
>
> Then build it into a cdb:
>
> cdbmake domainlist.cdb domainlist.cdb.tmp < datafile
>
> Then you check the database with cdbget
> (http://cr.yp.to/cdb/cdbget.html), like so:
>
> cdbget suspiciousdomain.com < domainlist.cdb

excellent!

thanks a lot Kyle!

>
> ~Kyle
> - --
> It was luxuries like air conditioning that brought down the Roman
> Empire. With air conditioning their windows were shut, they couldn't
> hear the barbarians coming.
> -- Garrison Keillor
> -----BEGIN PGP SIGNATURE-----
> Comment: Thank you for using encryption!
>
> iEYEARECAAYFAkk3E50ACgkQBkIOoMqOI15oyQCgjufFFxVDILnzPlejR4qT8fRO
> npoAoLTorPm2H41JkG3+KvYesa0L2lyO
> =p6CC
> -----END PGP SIGNATURE-----
>



--
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu

Qmail users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.