Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 2nd September 2009, 07:09
fujipadam fujipadam is offline
Junior Member
 
Join Date: Sep 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Smile Script to delete emails based on subject

Hi,

I would like your input and advice on dealing with some email issues.

We have some 40,000 emails in one of our mailboxes (name@emaildomain.com) with a single subject ("Mail delivery failed: returning message to sender")

I would like to delete all of these messages with this subject. I am not able to do this using regular email clients such as outlook or thunderbird (extremely time consuming.)

Is there a way I could do this via command line or a script?

I would appreciate any input and help in this regard.

Thanks,

Fuji
Reply With Quote
Sponsored Links
  #2  
Old 2nd September 2009, 15:19
id10t id10t is offline
Senior Member
 
Join Date: Nov 2008
Posts: 242
Thanks: 2
Thanked 22 Times in 22 Posts
Default

Are you using Maildir or mbox format?
Reply With Quote
  #3  
Old 2nd September 2009, 19:37
fujipadam fujipadam is offline
Junior Member
 
Join Date: Sep 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi - I am using Maildir format
Reply With Quote
  #4  
Old 2nd September 2009, 22:16
id10t id10t is offline
Senior Member
 
Join Date: Nov 2008
Posts: 242
Thanks: 2
Thanked 22 Times in 22 Posts
Default

each message has a individual file, and you can grep for the subject line, cut the first field delimited by a colon and then delete that list of files.
Reply With Quote
The Following User Says Thank You to id10t For This Useful Post:
fujipadam (3rd September 2009)
  #5  
Old 3rd September 2009, 23:43
fujipadam fujipadam is offline
Junior Member
 
Join Date: Sep 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks id10t - I had to use xargs since the list of files were too large for grep to handle - but overall the approach seems to work - will test it out a couple of times and then use it on the production machine
Reply With Quote
  #6  
Old 27th July 2013, 16:02
DoctorMendel DoctorMendel is offline
Junior Member
 
Join Date: Jul 2013
Location: n/a
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up

Thanks for starting that topic.
__________________
filmy porno za darmo
Reply With Quote
  #7  
Old 29th October 2013, 12:59
RogerBennett RogerBennett is offline
Junior Member
 
Join Date: Oct 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have already using this script looking for new
__________________
eowyn sword
Reply With Quote
  #8  
Old 9th January 2014, 04:17
biggdog biggdog is offline
Member
 
Join Date: Nov 2010
Posts: 62
Thanks: 3
Thanked 6 Times in 6 Posts
Default

Quote:
Originally Posted by fujipadam View Post
Hi,

I would like your input and advice on dealing with some email issues.

We have some 40,000 emails in one of our mailboxes (name@emaildomain.com) with a single subject ("Mail delivery failed: returning message to sender")

I would like to delete all of these messages with this subject. I am not able to do this using regular email clients such as outlook or thunderbird (extremely time consuming.)

Is there a way I could do this via command line or a script?

I would appreciate any input and help in this regard.

Thanks,

Fuji
I may not totally understand but I know I have a problem that is like yours although not 40,000 of them but a lot over 1,000 I create a rule in Outlook and also mark it as read and send it to the trash.
I would like to see your script if and when you get this done and tested. I would like to see if it can help in our situation.
Thanks for the post / question.
Reply With Quote
  #9  
Old 15th January 2014, 17:19
zapper911 zapper911 is offline
Junior Member
 
Join Date: Jan 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

If you have access to mail server, you can grep/find through mailbox for your text and delete matched files. This approach will work only if your mail server store each message in individual file.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
freebsd 7, samba 3, domain controller alexdimarco Suggest HOWTO 6 5th November 2010 17:54
Internet Explorer won't connect to my server wctaelectronics Server Operation 10 27th October 2008 22:14
Postfix script to delete messages older than 8 hours scrapper777 Programming/Scripts 0 19th April 2008 17:23
Delete whole line based on pattern ramangill Programming/Scripts 1 2nd November 2007 16:33
OT: Problems sending emails to gmail. I used postfix debian install (based falko) tuflipes HOWTO-Related Questions 20 29th May 2007 01:01


All times are GMT +2. The time now is 12:57.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.