views:

30

answers:

2

Hey Guys,

The Problem:

I'm looking for a way to create a program that visits an email host site and log in with a specific credentials and deletes all message at the Inbox and clears the Trash folder.

Background:

I have an email with my domain and that email is hosted on some ISP server. However I have enabled auto-forward all my emails to my gmail, the thing is that there is no option for auto deleting arriving messages so my inbox with its limited size (10MB) gets full and I stop receiving emails. My solution till today was to empty it manually when I remember to or when someone calls me and asks me why my inbox is full. The ISP said that in order to overcome this problem I should upgrade my qouta at their server for some extra $$ per month and Its a thing that I won't do.

So I'm looking for a way to do this automatically. My impressions as beginner program is to write a script that does that and runs at every system start. My system would be Windows 7, so I thought to work it out with VBScript.

It would be my first experience with VBScript, so any suggestions would be welcomed. On the other hand if you think there is a better way to do that rather than VBScript tell me :) I prefer to write a program that I fully understand, so my experience in programming would be: Pascal/C/C++/Java/C#/ML/Prolog/Squeak(smalltalk)/TCSH(CShell).

Thanks in advance, Jalil

A: 

This link might be useful. If the account uses POP3 you can connect via Telnet, and delete the messages that way.

Tester101
+1  A: 

Depends on what email server you use but if you have POP3 access all you really need to do is to connect to it with a TCP\IP connection and send some simple commands. So any language where you have a good library for making a simple connection should be fine.

Below I show how you could do it just using telnet (be careful doing this over the internet though since it's not using a secure connection):

telnet [hostname] 110

USER [username]
PASS [password]
LIST - gets you a list of all emails showing the msgindex and it's size    
DELE [msgindex]    
QUIT - the emails aren't deleted until you send QUIT!

All you need to do is to create a connection and send those commands in that order (waiting for the response and checking if it was + or - to know if it went ok or not).

Regarding language, if you do want to use a script language I'd consider Powershell since I think that supports the .Net framework classes and so would be really easy to do.

ho1
Is there any secure replacement for telent, because I'm planning in doing so over the internet ?!
LmSNe
@lmSNe: I'm not that good at these things, but you could probably get putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/) and set up to connect using SSL or something to make it secure (it would probably be another port though, maybe 465 or 587 or something). Might want to ask another question on the Superuser forum about *how to use putty to connect to a pop3 server securely for testing purposes* or something.
ho1
@lmSNe: If you want to make it an automated process though you could probably do it securely by combining the .Net `TcpClient` and the `SslStream`. You can find a sample here (http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx) that could probably be adapted for connecting to a POP3 server and send simple commands.
ho1