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.

Offline purvis

  • *****
  • 567
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #15 on: November 08, 2011, 10:31:57 AM »
Cactus, yes, far easier to post files on a web server, but i do not care for indexing or attacks of my web servers which are not meant for the entire world, just the users here. But i cannot control that if i post it here. base64 code will do for most power users.

Stuart, i have worked on the code already to remove emails from outside email accounts that match specifically to email accounts.
You might want those users to also look into the Pennock Email Notifier which is cheap and relatively safe for viewing emails and has some filtering capabilities.

Stuart, i have reasons to delete unwanted email's as well from specific sme email accounts and i like to clean up the "maillog" email account with these command line tools on a periodical bases.


 



« Last Edit: November 08, 2011, 10:36:14 AM by purvis »

Offline purvis

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

Offline purvis

  • *****
  • 567
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #17 on: November 08, 2011, 12:49:00 PM »
windows console programs to delete emails using pop3 protocol
programs that i have written are now at one of my servers

yes i am making the below a little hard to read for my own purposes, sorry.


financeinla at  my own com site

for access to the files use, the at sign followed by Mitel followed by 123 can be used

and the subdiectory is of course smeserver

there is a brief text file at the location too, the programs have a help screen if you just type the exe file name
« Last Edit: November 12, 2011, 03:29:00 AM by purvis »

Offline purvis

  • *****
  • 567
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #18 on: November 08, 2011, 01:12:25 PM »
Stuart, now you can delete those emails from bill.gates@microsoft.com or some.clown@hotmail.com using the program above

pop3delfrom.exe  which could be renamed to something more like pop3emaildeleteusingfromline.exe if wanted

pop3delfrom servername/ipaddress username? password? bill.gates@microsoft.com  some.clown@hotmail.com

if you do not want any email from microsoft.com and hotmail.com use the following
pop3delfrom servername/ipaddress username? password? @microsoft.com  @hotmail.com

or any last name gates using .gates@microsoft.com
or any last name ending with "gates" characters  using gates@microsoft.com

if you want to specify bill.gates@microsoft.com try using "<bill.gates@microsoft.com>"

so you might want to try
pop3delfrom servername/ipaddress username? password? bill.gates@microsoft.com  some.clown@hotmail.com "<bill.gates@microsoft.com>"  "<some.clown@hotmail.com>"
the brackets are not removed prior to comparing but the closing > bracket is added to the right side of email accounts for purposes of matching from left to right if a straight out match does not occur. so, bill.gates@microsoft.com will match with bill.gates@microsoft.com> located in the from line of the email.
this program has not been thoroughly tested but tested some during development.

added:
if you use greater than or less than brackets on the command line for email addresses, you will have to enclose them in double quote marks

added:
i have modified the programs to take on a simulated mode of deleting emails
now in order to delete the emails, the first command line  parameter option has to be "/d" or "/delete" or some partial spelling of "/delete" such as "/del".
also during the delete or simulated deleting, only the emails effected will be show on the screen.

i am going to place another two of my home grown programs i have written, but i am not giving away my source code.
both programs will not delete or erase any file, they are text viewers and one is a text manipulator 
a program called textv.exe to display text files. i wrote the program to
clipscr2.exe will create a file if you place the file on the command line tail. i need to get rid if it doing that.
clipscr2.exe was designed to actually on deal with moving text in and out using the windows clipboard.
both program where to help me look at log and text files, so they are not meant for any files but text.
clipscr2.exe was designed to help filter and sort text information
textv.exe can filter on text by line multiple times
the file sizes you can use can be as large as the memory in your computer.
 
« Last Edit: November 12, 2011, 03:49:41 AM by purvis »

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #19 on: November 08, 2011, 01:16:44 PM »
purvis

Serious users would not/should not consider using your your code without seeing the source code, for example to check the accuracy of the code and guard against security errors or bugs or unintended outcomes etc. It would be good if you post the source whenever you offer executable files or scripts for free to unknown users.

Having a file or two for download from your own web server is not really a security risk.
Alternatively there are many place on the Internet you can upload files to freely for download by anyone, without needing to use your own web accessible server.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline purvis

  • *****
  • 567
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #20 on: November 08, 2011, 01:21:39 PM »
removed
« Last Edit: November 12, 2011, 03:17:47 AM by purvis »

Offline mmccarn

  • *
  • 2,653
  • +10/-0
Re: Dropping email FROM an external mail account
« Reply #21 on: November 08, 2011, 01:35:13 PM »
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
Install the Mailsorting contrib, and create global rules matching the 'From' addresses you want to accept-but-ignore.

Offline purvis

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

Offline Stuart

  • **
  • 37
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #23 on: November 10, 2011, 11:42:22 PM »
Purvis,
[Sentence removed by moderator because it can be construed as inflamatory comment/statement]
Why are you posting all this here?  It doesn't even appear to address the original question I posted!
Why not make a Contrib or something and post it somewhere appropriate.  If you think might address a query, you can then point people to it.
Once again, I respect your effort, you obviously put a lot of work into it.

Mmccarn,
Someone suggested the mailsort contrib in another topic I posted here.  It seems the way to go, but; to me, the wiki instructions are incorrect.  The commands as listed had to be modified to work.  I set up some rules but it just succeeded in stalling the mail queue.  I can't spend the rest of my life on this and the client agreed to just let it bounce.
« Last Edit: November 11, 2011, 04:48:41 AM by chris burnat »

Offline mmccarn

  • *
  • 2,653
  • +10/-0
Re: Dropping email FROM an external mail account
« Reply #24 on: November 11, 2011, 01:10:19 PM »
Mmccarn,
Someone suggested the mailsort contrib in another topic I posted here.  It seems the way to go, but; to me, the wiki instructions are incorrect.  The commands as listed had to be modified to work.  I set up some rules but it just succeeded in stalling the mail queue.  I can't spend the rest of my life on this and the client agreed to just let it bounce.

Sorry to hear it.  'mailsorting' always looked really useful to me too, but I never feel like I understand the instructions (so I've never tried to install it)...

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Dropping email FROM an external mail account
« Reply #25 on: November 11, 2011, 10:20:43 PM »
It seems the way to go, but; to me, the wiki instructions are incorrect.  The commands as listed had to be modified to work.

It's a wiki, so you can comment or make changes if you think there are any errors.

Offline chris burnat

  • *****
  • 1,135
  • +2/-0
    • http://www.burnat.com
Re: Dropping email FROM an external mail account
« Reply #26 on: November 12, 2011, 12:03:27 AM »
Sorry to hear it.  'mailsorting' always looked really useful to me too, but I never feel like I understand the instructions (so I've never tried to install it)...

I have been using this contrib for a long time now, I block particular mail based on the "Email Address From" criteria using Maildrop.  I recall being told by Stephen Noble (the maintainer) something to the effect that Procmail did not work so good.  And yes, the Wiki are somewhat cryptic and could do with some clarification. Most of the other features of this contrib are lost on me since I do not understand how it works...
- chris
If it does not work out of the box, please fill in a Bug Report @ Bugzilla (http://bugs.contribs.org)  - check: http://wiki.contribs.org/Bugzilla_Help .  Thanks.

Offline purvis

  • *****
  • 567
  • +0/-0
Re: Dropping email FROM an external mail account
« Reply #27 on: November 12, 2011, 03:31:31 AM »
i have erased all base64 code and setup a server with windows console executable files that have been recoded to allow a safety measure.
please see my post above

Stuart, i mentioned that i misread your wants. Possible you did not see that.

I now know what you wanted. But if you wanted something useful to help manage those unwanted emails
in a more manual way, that is what i was helping to supply you with. I needed to program those for myself as well.
We do not use automated email readers such as OUTLOOK and whatever thanks to all the spammers and viruses from email.
These are just other tools and if a person does not like leaving passwords and user names in files, these programs can help you
over come that.  The program pop3delfrom will accept up to 1000 email senders and use also domain name descriptions too in an effort to
delete unwanted mail or mail that gets placed into the mail logging user account that grows and grows.

Anyway, have a great weekend.
« Last Edit: November 12, 2011, 04:02:26 AM by purvis »