<br><br><div class="gmail_quote">2010/6/23 Alex Neuman <span dir="ltr"><<a href="mailto:alex@rtpty.com">alex@rtpty.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I've got a user who got his laptop stolen and used POP for his email. The default action for nonspam being "store", his emails can be "released" so he can receive them again.<br>
If I wanted to do a little script-fu to release everything "to or from him", what would I have to find/grep/formail to just send everything out in one swoop? Any ideas? Thanks in advance.<br>
--<br></blockquote><div><br></div><div>In the past i wrote this "script" to release a lot (over 10000) emails from quarantine because of a wrong blacklist entry. I havent run it in a while so take it with extreme care. also you have to modify the "release order" according to your mailwatch installation.</div>
<div><br></div><div>you have to customize the sql select to match your from/to/etc.</div><div><br></div><div>hope it helps you!</div><div><br></div><div>massive_releasery.py</div><div><br></div><div><div><div>#! /usr/bin/env python</div>
<div><br></div><div>#<span class="Apple-tab-span" style="white-space:pre">        </span>Masive Releaser</div><div>#<span class="Apple-tab-span" style="white-space:pre">        </span>Desc: Este script ejecuta un query SQL para obtener el set de ids para hacer el release de cuarentena</div>
<div>#<span class="Apple-tab-span" style="white-space:pre">        </span>Writed by Eduardo Casarero <a href="mailto:eduardo.casarero@informaticaavanzada.com.ar">eduardo.casarero@informaticaavanzada.com.ar</a> - Ene 2008</div><div>
#<span class="Apple-tab-span" style="white-space:pre">        </span>v0.01 - Version Inicial</div><div><br></div><div>import datetime </div><div>import MySQLdb </div><div>import os</div><div>import time</div><div><br></div><div>
MYSQL_IP='localhost'</div><div>MYSQL_USER='root'</div><div>MYSQL_PASS='myrootpassword'</div><div>SQL_LOW_LIMIT=0</div><div>SQL_HIGH_LIMIT=500</div><div>LOG_FILE='/tmp/masive_releaser.log'</div>
<div>counter= SQL_LOW_LIMIT</div><div><br></div><div>#Genero la conexion a la base de datos</div><div>dbcontroller=MySQLdb.connect(host=MYSQL_IP,user=MYSQL_USER,passwd=MYSQL_PASS,db='mailwatch')</div><div>cursorcontroller=dbcontroller.cursor()</div>
<div><br></div><div>#Contadores de tiempo para control</div><div>t0=time.time()</div><div>#Calculando la fecha</div><div>fecha = datetime.datetime.now()</div><div><br></div><div>sql='SELECT id,hostname FROM maillog WHERE date > "2009-04-31" and from_domain="<a href="http://amadeus.net">amadeus.net</a>" and to_domain="<a href="http://domain.com">domain.com</a>" and isspam="1";'</div>
<div><br></div><div>#print sql</div><div>cursorcontroller.execute(sql)</div><div>id_mails=cursorcontroller.fetchall()</div><div>counter_time=0</div><div><br></div><div>for id_mail in id_mails:</div><div> if (counter_time==15):</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>time.sleep(60)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>counter_time=0</div><div> os.system('echo "Releasing this '+str(id_mail[0])+' nro:'+str(counter)+' de '+str(SQL_HIGH_LIMIT)+'" >>'+LOG_FILE)</div>
<div> release_order = 'php release_msg.php '+str(id_mail[1])+' 80 '+str(id_mail[0])+' >>'+LOG_FILE+' 2>>1'</div><div> os.system(release_order)</div><div> #print release_order</div>
<div> counter=counter+1</div><div> counter_time=counter_time+1</div><div> print str(id_mail[0])+" Released nro:"+str(counter)+' de '+str(SQL_HIGH_LIMIT)</div><div><br></div><div>#closing db connection</div>
<div>dbcontroller.close()</div></div></div><div><br></div><div># END</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Alex Neuman<br>
BBM 20EA17C5<br>
+507 6781-9505<br>
<a href="mailto:Skype%3Aalex@rtpty.com">Skype:alex@rtpty.com</a><br>
<font color="#888888">--<br>
MailScanner mailing list<br>
<a href="mailto:mailscanner@lists.mailscanner.info">mailscanner@lists.mailscanner.info</a><br>
<a href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" target="_blank">http://lists.mailscanner.info/mailman/listinfo/mailscanner</a><br>
<br>
Before posting, read <a href="http://wiki.mailscanner.info/posting" target="_blank">http://wiki.mailscanner.info/posting</a><br>
<br>
Support MailScanner development - buy the book off the website!<br>
</font></blockquote></div><br>