Koozali.org: home of the SME Server

Dropping email FROM an external mail account

Offline Stuart

  • **
  • 37
  • +0/-0
Dropping email FROM an external mail account
« on: October 20, 2011, 12:48:01 AM »
I need to drop email from a particular external user without sending a reject or bounce to them.
Anyone have an idea on how to do this?

Thanks

Offline Stuart

  • **
  • 37
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #1 on: October 20, 2011, 03:05:01 AM »
I have created a rule that adds 999 to the spam score for a particular email address.  I now need to use the cutofflevel.
I have used it on non SME servers.  It doesn't appear to be used in SME and searching Contribs.org yeilds no results.
« Last Edit: October 20, 2011, 03:16:14 AM by Stuart »

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Dropping email FROM an external mail account
« Reply #2 on: October 20, 2011, 06:35:24 PM »
You could create a .qmail file for that account in the user space of the user, this should make qmail think it delivered the mail where it will not be saved. See also: http://www.lifewithqmail.org/lwq.html#throwing-messages-away.

On SME Server this could be done by setting the email delivery for that account to anything else then local or both according to the 90local template fragment:

Code: [Select]
[root@smetest ~]# cat /etc/e-smith/templates-user/.qmail/90local
{
    # vim: ft=perl:
    return '# No local delivery'
         unless ($props{EmailForward} =~ /^(local|both)$/);

    return './Maildir/';
}
[root@smetest ~]#

Something like this should do that trick:
Code: [Select]
db accounts setprop username EmailForward blackhole
signal-event email-update
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Stuart

  • **
  • 37
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #3 on: October 25, 2011, 07:12:07 AM »
Hey Cactus,

I think you misunderstand.  The email address is not on our domain.  What I'm after is a way to blackhole all email from someone like bill.gates@microsoft.com or some.clown@hotmail.com regardless of who it is sent to on our domain.
The server is to accept the email connection and return o.k., then simply drop or delete the email.

For the record, I am aware this is bad practice, but it is what has been asked of me.

Stuart

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Dropping email FROM an external mail account
« Reply #4 on: October 25, 2011, 10:19:21 AM »
You can create a custom template fragment for /var/qmail/control/badmailfrom - but that will cause a reject notice to be sent to the sender.

To avoid the reject notice, your system has to accept the message, then just not save it into a folder. I think you would need to have a custom qpsmtpd plugin to do this with SME server.

Offline Stuart

  • **
  • 37
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #5 on: October 26, 2011, 12:33:57 AM »
Thanks Charlie.  That was pretty much the conclusion I had come to.  I was just hoping there was a simpler way to do it.

Offline axessit

  • *****
  • 213
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #6 on: November 04, 2011, 02:43:49 AM »
Two things,

Quote
I have created a rule that adds 999 to the spam score for a particular email address.  I now need to use the cutofflevel.
Then you should be able to configure the Spamassassin, and that works.

or what about blacklisting the email address in webmail ?

Offline purvis

  • *****
  • 567
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #7 on: November 04, 2011, 10:16:28 AM »
I had wrote a program for windows some time back to pop sme server account and delete certain mail using the subject descriptions or the sender. 
The program i wrote was written in powerbasic.
Here is some php source code that might be helpful to clean out some emails, if that helps you.
http://www.weberdev.com/get_example.php3?ExampleID=4015



Offline purvis

  • *****
  • 567
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #8 on: November 04, 2011, 10:40:55 PM »
i have written a program for windows that will delete any email from any sender to a given certain user email account where the subject line matches.
example of the program command line as follows
pop3delete myserver.com username userpassword "Cron <root@server> run-parts /etc/cron.daily"
this will delete all emails from any sender to the username email account with the subject line "Cron <root@server> run-parts /etc/cron.daily"
i do not want to post my server web here, maybe i can list the base64 here.
any suggestions for those who want the program welcomed
the program is 46,080 characters in size.

the program is best if used inhouse and does not use pop3s(ssl), it only uses pop3



 
« Last Edit: November 04, 2011, 10:45:03 PM by purvis »

Offline purvis

  • *****
  • 567
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #9 on: November 07, 2011, 10:17:09 PM »
removed
« Last Edit: November 12, 2011, 03:22:11 AM by purvis »

Offline purvis

  • *****
  • 567
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #10 on: November 07, 2011, 10:18:22 PM »
removed
« Last Edit: November 12, 2011, 03:22:29 AM by purvis »

Offline purvis

  • *****
  • 567
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #11 on: November 07, 2011, 10:26:37 PM »
i used this site to convert(encode and decode) the base64
http://www.motobit.com/util/base64-decoder-encoder.asp
at this point in time, all you have to do is paste your base64 code in the textbox, click on encode and export to binary file.
the file created will need to named to pop3del.zip and have a file size of 27,294 characters.

in windows, from the command prompt i used notepad to open a file such as temp.64
notepad temp.64
from this forum, click on select in the first post of the code, then paste in notepad
go to the bottom left of the text  in notepad and  do the same for the second posting.
again, past the second posting starting at the left column.
now, go to the bottom, removing all blank lines if any, the right click on the mouse to select all using copy and paste
paste the text in the website give above and select the options on the webpage that are appropriate
i have tested the above steps and created an exact file with the exception of file timestamps.



« Last Edit: November 07, 2011, 10:48:55 PM by purvis »

Offline purvis

  • *****
  • 567
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #12 on: November 07, 2011, 11:07:14 PM »
Stuart, sorry i misread your post in what you where doing. It was really late in the morning and i was so tired. But i did want to share that code anyways that posted.
I do not know of the number of email account users you are trying to block these messages from getting to.
I think i will write another program in an effort to delete email from a particular email account in much the same fashion as my program deletes emails using a subject.
I do have the program where you can do subject line matching but that can easily wipe out a lot of email is not done correctly. Could you imagine matching on a single character, maybe even a space character. haha to anybody doing that, drink celebration after doing that, right?
 

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Dropping email FROM an external mail account
« Reply #13 on: November 07, 2011, 11:18:12 PM »
i used this site to convert(encode and decode) the base64
http://www.motobit.com/util/base64-decoder-encoder.asp
at this point in time, all you have to do is paste your base64 code in the textbox, click on encode and export to binary file.
the file created will need to named to pop3del.zip and have a file size of 27,294 characters.
Wouldn't posting it on some file sharing platform been far easier?
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Stuart

  • **
  • 37
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #14 on: November 07, 2011, 11:36:05 PM »
Purvis,
You are insane.
I respect your effort.