test_mailpile.sikuli

(Download this script)
def create_tag(tag_name):
    click()
    click()
    click()
    type(tag_name)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.ENTER)
    if exists(Pattern().targetOffset(13,1)):
        click(Pattern().targetOffset(13,1))
    click()

def add_contact(name, email):
    click(Pattern().targetOffset(-71,-1))
    click()
    click()
    type(name)
    click()
    type(email)
    click()
    click(Pattern().targetOffset(119,35))
    click()

def send_email(to, subject, body):
    click(Pattern().targetOffset(-137,-2))
    click()
    type(to)
    type(Key.ENTER)
    click()
    type(subject)
    click()
    type(body)
    click()
    if exists(Pattern().targetOffset(13,1)):
        click(Pattern().targetOffset(13,1))
    click()


create_tag('foo')
add_contact("Bob Rock", "bobrock@metallica.net")
send_email(
    'Joker <thejoker@marvel.com>',
    'Come and face justice, Joker',
    'Your time is up, evil-doer'
    )