Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
strange reuest from a mate 
Author Message
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
Quote:
Do you know of any scripts or programs that can be run against email systems i.e. Hotmail, Gmail that can automatically open emails and click on links?

Something like data load or program that works in the background...
He wrote

I challenged him and he cam back with this
Quote:
I need to set up some demo data for a company and these will include dispatches to bogus email account and then reports on open rates and clicked links. We're looking at around 5k email address all linked to a single grouped email address (gmail) so I need a program that will go through a set number of these emails and click specifically named links!

As we're crating more and more of these demo accounts to get someone to manually do this is very painful so want to ease the load! and automate it


I am totally happy he is kosha. So anybody got any ideas. :?

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Thu Aug 19, 2010 5:50 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5159
Location: /dev/tty0
Reply with quote
I'd look at something like this:
http://webdesign.ittoolbox.com/groups/t ... rl-1458184

Then create a script to scrape links out...

I'll take a look tomorrow.


Thu Aug 19, 2010 7:31 pm
Profile WWW
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
cheers Ben

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Fri Aug 20, 2010 6:10 am
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5159
Location: /dev/tty0
Reply with quote
Quick question, do the links need to be to a specific address, or contain specific text?

i.e. should it always pick up http://www.example.com when written just like that and when it's inside a link tag, or does he just want to get
<a href="www.example.com>this bit of the text</a>


Last edited by forquare1 on Fri Aug 20, 2010 6:39 am, edited 1 time in total.



Fri Aug 20, 2010 6:21 am
Profile WWW
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
Quote:
Links are generally written like the later though "<a hreaf="www.example.com>this bit of the text</a>" so would guess this is more likely...
Would it make a difference? because its just demo data I'm totally flexible on how we build the links in the emails.


was his response

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Fri Aug 20, 2010 6:35 am
Profile WWW
Has a life

Joined: Fri Aug 20, 2010 4:03 pm
Posts: 4
Reply with quote
Hi All

The link could work of either a specific address or a specific text, as the data I'll be affecting is demo/testing data I can build it as required....

:D


Fri Aug 20, 2010 4:07 pm
Profile
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
Just so everybody understands Col is the mate who asked the question :D

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Fri Aug 20, 2010 4:09 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5159
Location: /dev/tty0
Reply with quote
Hi Col,

I've had a bit of a hectic day and haven't been able to really look at it, that should change this evening and I hope to have something by the end of the weekend.

At the moment I'm thinking you'll call the script and give it a file containing email account details and the string (link/text) you want it to look for.
Do you then want the script to open that link in a browser? Or just report that it found the link/text?


Fri Aug 20, 2010 4:17 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5159
Location: /dev/tty0
Reply with quote
I have something...

I have a program that reads email account information and search terms from a file then connects to the email account and searches for messages with the search term in. It then logs the total number of messages that matched the search term as well as the overall total in a separate file.

The file with account information in should be called "accounts.csv" and should be in the same folder as the perl script. I chose CSV as I thought you could put all of your data in Excel/Calc and export it, which might make life easier. The results will be written to the same folder in a file called "results.csv", again CSV was chosen as you could import the results into Excel/Calc for easy viewing.

To run the script you must have Perl 5.8.9 or higher (lower may work, but the the earliest I have is 5.8.9) and you must have the module Mail::IMAPClient installed for that version of Perl.
On Windows you'll probably want Strawberry Perl. Installation of Strawberry Perl is really easy (I've just done it on XP). Installing modules is a little harder: open a command window (start > run > cmd > ok) and type "cpan Mail::IMAPClient" (no quotes), it should then install it for you.

Your accounts.csv file should look something like this:
Code:
username,password,server_address,port,search terms

For example:
Code:
john,hsgaty345,imap.gmail.com,993,www.example.com
superted110,banana,imap.gmail.com,993,www.example.com


Download this zip file: Perl script in a zip file

Save and unzip that somewhere (e.g. Desktop) as "email.pl" (no quotes).
Open up a cmd window (start > run > cmd > ok) and type "cd C:\location\of\email.pl" (e.g. "cd C:\Documents and Settings\user\Desktop", no quotes)
Then type "perl email.pl"
You should see a file called "results.csv" appear, and in the command window you should see something like "Total count is: 10" when the script finishes.

If you need it to actually click the link, reply back and I'll see what I can do :)

Ben


Sat Aug 21, 2010 1:24 pm
Profile WWW
Has a life

Joined: Fri Aug 20, 2010 4:03 pm
Posts: 4
Reply with quote
Hi Ben

Thanks for this! Will take a look now!


Last edited by Col on Sun Aug 22, 2010 8:31 am, edited 1 time in total.



Sun Aug 22, 2010 8:09 am
Profile
Has a life

Joined: Fri Aug 20, 2010 4:03 pm
Posts: 4
Reply with quote
Hi Ben.

Yes I need it to both open the emails and click on the links, that way the actions will show in the system.

Many Thanks

Col


Sun Aug 22, 2010 8:31 am
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5159
Location: /dev/tty0
Reply with quote
OK, this new script does exactly the same as before, but it now follows the link. You won't see a browser window pop up, but it will register on the server as someone accessing that page.

You can get the script from here.

To get the extra functionality I have had to use more modules. To install them, open up the command prompt and type:
Code:
cpan Mail::IMAPClient LWP::Simple LWP::UserAgent HTTP::Request HTTP::Response Module::Build Test::More URI::URL


Once that has finished, go here and download the module. Uncompress it (may need winzip or similar) then open up a command prompt. Type the following:
Code:
cd C:\path\to\uncompressed\folder
perl Build.pl
Build
Build test
Build install

You may have to type in ".\Build" or "./Build" for the last three commands to work.

Once that has installed, use this new script just like the previous one. The script looks at each account and each email in that account, it then looks at all of the URLs in the email and looks to see if one matches the search string (remember you put that in accounts.csv), if it finds a corresponding URL then it'll load it up which won't show up on your screen, but should register with the server. I have kept the counting mechanism in just incase that was useful.

Give me a should if it doesn't work or you need something else,
Ben


Last edited by forquare1 on Sun Aug 22, 2010 2:54 pm, edited 1 time in total.



Sun Aug 22, 2010 2:50 pm
Profile WWW
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
Very impressive Ben and thanks for Helping Col out.

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Sun Aug 22, 2010 2:52 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5159
Location: /dev/tty0
Reply with quote
AlunD wrote:
Very impressive Ben and thanks for Helping Col out.


Not a problem, it's helped me do a bit more perl programming, I'm just sorry it's not a little more user friendly (i.e. a GUI app rather than a cli utility...)


Sun Aug 22, 2010 2:56 pm
Profile WWW
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
forquare1 wrote:
AlunD wrote:
Very impressive Ben and thanks for Helping Col out.


Not a problem, it's helped me do a bit more perl programming, I'm just sorry it's not a little more user friendly (i.e. a GUI app rather than a cli utility...)


Don't worry Colin is perfectly at home at the command line.

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Sun Aug 22, 2010 2:58 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 16 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.