Displaying list of SG addresses about to expire

General discussion re sg.

Displaying list of SG addresses about to expire

Postby phillyuser » Wed Feb 08, 2006 1:26 am

Is there any way to have SpamGourmet display a list of my SG addresses that are close to reaching their limit? For example, if I have 100 SG addresses and 15 of them are two or less away from the number of e-mails I've specified that I want to receive, those 15 would appear in a list. This would be an Advanced Mode feature, of course. Perhaps there would be a blank I'd need to fill in first, representing what I consider to be "close" to the limit, so in the example above I'd have typed in 2.
phillyuser
 
Posts: 6
Joined: Wed Jan 25, 2006 9:44 pm

Postby SysKoll » Wed Feb 08, 2006 3:59 am

In advanced mode, click on the "search addresses" button without entering anything in the box. You get a full list of all your disposables. Now click on the "Remaining" header of the table. It sorts the list by remaining messages. That's what you are concerned about, I believe.
-- SysKoll
SysKoll
 
Posts: 893
Joined: Thu Aug 28, 2003 9:24 pm

Postby phillyuser » Wed Feb 08, 2006 4:07 am

Yup, that's what I was thinking about. Thank you. I never considered that the column titles were clickable because they don't appear as links. Boy, you folks have really thought of just about everything in building this wonderful facility.

You know what would be nice? If I do a search and see all my SG addresses and one of the columns is labeled Hide. That column would have checkboxes in it so I can indicate I want to make those addresses hidden, then I could make a whole slew of no-longer used addresses hidden all in one shot by checking off as many checkboxes as I want, then clicking a submit button. Is that a possibility?
phillyuser
 
Posts: 6
Joined: Wed Jan 25, 2006 9:44 pm

Postby josh » Wed Feb 08, 2006 8:45 pm

We had been generally putting off changes to the web interface pending an expected overhaul of the whole thing. That overhaul has gotten behind schedule (by about a year, I guess), so I suppose we can start thinking about general improvements to the existing interface.

I'll post in the developer forum about this.
josh
 
Posts: 1371
Joined: Fri Aug 29, 2003 2:28 pm

Shell script for notification

Postby Roshan » Sun Apr 09, 2006 10:19 am

I found that I often missed seeing the "LAST ONE" e-mail for accounts which were expiring, so I cooked up the following scripts to e-mail me each day with the details of any accounts which had expired that day.

To do this, first create a file ~/.spamgourmetrc, with the following template:

Code: Select all
USER=yourspamgourmetusername
PASS=yourspamgourmetpassword


Then create the following file. I named it ~/bin/getSpamGourmetXML.

Code: Select all
#!/bin/bash
. ~/.spamgourmetrc
curl -s -o /dev/null -b ~/.spamgourmetcookies -c ~/.spamgourmetcookies -d user=$USER -d pass=$PASS http://www.spamgourmet.com/disposableemail.pl
curl -s -o ~/spamgourmet.xml -b ~/.spamgourmetcookies -c ~/.spamgourmetcookies "http://www.spamgourmet.com/disposableemail.pl?xml=1"
curl -s -o /dev/null -b ~/.spamgourmetcookies -c ~/.spamgourmetcookies -g -d "logout=log out" http://www.spamgourmet.com/disposableemail.pl


And here's the script which finds your expired addresses:

Code: Select all
#!/bin/bash
~/bin/getSpamGourmetXML
xml sel -t -m "/DisposableAddresses/DisposableAddress[CountRemaining='0']" \
        -v "Word" \
        -i 'not(position()=last())' -n -b  \
        ~/spamgourmet.xml > ~/data/SpamGourmetZeroList.tmp
grep -v -f ~/data/SpamGourmetZeroList ~/data/SpamGourmetZeroList.tmp > /dev/null
if [ $? -eq 0 ]; then
        unset IF; for i in `grep -v -f ~/data/SpamGourmetZeroList ~/data/SpamGourmetZeroList.tmp`; do if [ "$IF" = "" ]; then IF="Word='$i'"; else IF="$IF or Word='$i'"; fi; done ;

        PARAM='/DisposableAddresses/DisposableAddress['$IF']'
        (
        cat ~/templates/expiredspamgourmet
        echo
        echo "The following renewable addresses have expired: "
        echo
        xml sel -t -m "$PARAM" \
                -v Word -o " " -v FullAddress -n \
                -o "    " -v NumForwarded -o " mails forwarded since " -v Created -o " " \
                -i "ExclusiveSender!=''" -n -o "    Exlusive sender: " -v ExclusiveSender -b \
                -i "Note!=''" -n -o "    Note: " -v Note -b \
                -n -i 'not(position()=last())' -n -b \
                ~/spamgourmet.xml) | /usr/sbin/sendmail -oi -t
        mv ~/data/SpamGourmetZeroList.tmp  ~/data/SpamGourmetZeroList
fi


You need to create a ~/data directory, and you also need to have xmlstarlet installed. Download and install xmlstarlet from http://xmlstar.sourceforge.net/

Finally, create a file named ~/templates/expiredspamgourmet
Code: Select all
From: Spamgourmet Reporter <devnull@mydomain.com>
To: youraddress@mydomain.com
Subject: Expired Spamgourmet addresses
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: SpamGourmet checker by Roshan


Change the 'To', 'From' and 'Subject' fields in the template file to be whatever is suitable.

Set up a cron job which will run once a day. Pick a random time, so not everyone hits the Spamgourmet server at the same time. :-)

My cronjob looks like this:
Code: Select all
21    6       *       *       *       /home/roshan/bin/SpamGourmetReport


And that's it.

The e-mails you get will look something like this:

Code: Select all
The following renewable addresses have expired:

milesmore xxx.milesmore.n.yyy@xoxy.net
    14 mails forwarded since 2005-08-22 17:43

opodo xxx.opodo.n.yyy@xoxy.net
    67 mails forwarded since 2004-12-09 15:27
    Exlusive sender: opodo@email.digitalmarketingdirect.com


Hope this helps.

Roshan
http://roshan.info
Roshan
 
Posts: 6
Joined: Sun Apr 09, 2006 10:00 am

Postby SysKoll » Sun Apr 09, 2006 3:25 pm

Great work, Roshan! Thanks for posting it.
-- SysKoll
SysKoll
 
Posts: 893
Joined: Thu Aug 28, 2003 9:24 pm

Postby josh » Thu Apr 13, 2006 8:22 pm

wow!

If you like, you can simplify that by requesting the XML in the initial http request -- ?user=$USER&pass=$PASS&xml=1
josh
 
Posts: 1371
Joined: Fri Aug 29, 2003 2:28 pm

Postby Paranoid2000 » Fri May 12, 2006 11:24 am

On a related topic, having the ability to increment the counters for all expired (or about-to-expire) non-hidden addresses could be useful also (something like "Set counters to X if currently between Y and Z" where X, Y, Z are user specified values). Since this would apply to non-hidden addresses only, it allows users to exempt "terminated" aliases by hiding them.
Paranoid2000
 
Posts: 71
Joined: Wed Dec 15, 2004 10:48 am

Postby Roshan » Sat May 13, 2006 8:49 am

Hi Josh, SysKoll,

What would be the best way to get a list of the Spamgourmet "word" and "EmailID" for an account? Is there any parameter I could pass to get this via the XML file? Also, what role does the RandomNumber have? Is this to prevent a proxy from providing cached data, or is it used as a security token, allowing updates if the submitted form contains the exact RandomNumber from the generated form? I think I might cook up a script to handle Paranoid2000's suggestion, if I could get some input from you guys. :)

Thanks!

Roshan
Roshan
 
Posts: 6
Joined: Sun Apr 09, 2006 10:00 am

Postby josh » Tue May 16, 2006 1:43 pm

the random number is merely to prevent proxy (and other) caching. The security token is the cookie.

The IDs and Words are contained in the XML file, aren't they? If not, let me know. The DTD for the XML file is hopefully referenced in the XML file itself, and exists on the website. If the XML is parsed into some data structure, it should be fairly trivial to pull out parts of it.
josh
 
Posts: 1371
Joined: Fri Aug 29, 2003 2:28 pm

Postby Roshan » Tue May 16, 2006 2:48 pm

At the moment, the XML contains the "Word", but not the ID attribute:
Code: Select all
 <DisposableAddress>
  <Word>opodo</Word>
  <MaxCount>20</MaxCount>
  <CountRemaining>20</CountRemaining>
  <NumForwarded>72</NumForwarded>
  <NumDeleted>8</NumDeleted>
  <Created>2004-12-09 15:27</Created>
  <FullAddress>xxx.opodo.n.yyy@xoxy.net</FullAddress>
  <ExclusiveSender>@opodo.com</ExclusiveSender>
  <Hidden>0</Hidden>
  <Note></Note>
 </DisposableAddress>

I could cook up a curl or wget call which gets processed through sed and awk to give me a list of IDs and associated words, but it would be neater if this information were in the XML itself, so adding that would be really great. :wink: Once I had that, it would be trivial to finish up the rest of the script.

Thanks!

Roshan
Roshan
 
Posts: 6
Joined: Sun Apr 09, 2006 10:00 am

Postby josh » Wed May 17, 2006 9:29 pm

oh.... I'll add the IDs to the XML.
josh
 
Posts: 1371
Joined: Fri Aug 29, 2003 2:28 pm

Postby josh » Wed May 17, 2006 9:34 pm

ok. done.
josh
 
Posts: 1371
Joined: Fri Aug 29, 2003 2:28 pm

Return XML list as a result of FORM post?

Postby Roshan » Tue May 23, 2006 8:50 am

Hi,

I've been playing around with this, and one thing led to another, and the end result of this seems to be that I'm building a command-line interface to SpamGourmet. :-) It pretty much works the way I had planned, but I'd like to reduce the number of requests I make to the SG server.

At the moment, after I do a POST to update an individual account details (update the counter, change the note, etc), I always end up receiving the HTML version of the email list back. Appending "?xml=1" to the POST URL doesn't make any difference, while adding "xml=1" to the POST data results in my only receiving the XML list, without the update on the e-mail address occuring.

Of course I could break this into two requests, but I was hoping to reduce the total number of requests made against the SG server. Is there any way I could perform the update, and receive the resulting XML, in only one request? Appending "xml=1" to the POST URL or to the POST data seems the most intuitive way to request this so that it returns the XML, instead of the default HTML.

Do you think that would be feasible?

Roshan
Roshan
 
Posts: 6
Joined: Sun Apr 09, 2006 10:00 am

Postby SysKoll » Tue May 23, 2006 2:16 pm

That's great. Could you post your scripts somewhere?

As for lowering the number of requests, I'm sure Josh is all for it.
-- SysKoll
SysKoll
 
Posts: 893
Joined: Thu Aug 28, 2003 9:24 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 91 guests