Boat Drinks  

Go Back   Boat Drinks > General > Computer and Consoles

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 17-04-2009, 23:49   #11
Daz
The Stig
 
Daz's Avatar
 
Join Date: Jun 2006
Location: Swad!
Posts: 10,713
Default

Ok, Dee was playing 80's game, so happened to have laptop Only quick and dirty, so excuse the lack of comments.

Code:
#!/usr/bin/env python

import urllib2, smtplib

def mail(serverURL=None, sender='', to='', subject='', text=''):
    """
    Usage:
    mail('somemailserver.com', 'me@example.com', 'someone@example.com', 'test', 'This is a test')
    """
    headers = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (sender, to, subject)
    message = headers + text
    mailServer = smtplib.SMTP(serverURL)
    mailServer.sendmail(sender, to, message)
    mailServer.quit()


baseurl = 'http://www.cokezone.co.uk/home/catalogue/reward/prod1020003/Xbox/200+Points+for+Xbox+Live'
page = urllib2.urlopen(baseurl)
source = page.read()
if 'soldout' in source:
  print 'Still none...'
else:
  mail('my.mail.server', 'me@me.com', ['me:me.com'], 'CokeZone MS Points', 'Cokezone has points, go go go!')
  print 'Found some! Emailed.'
__________________
apt-get moo
Daz is offline   Reply With Quote
 


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


All times are GMT +1. The time now is 20:07.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.