Skip to content

Instantly share code, notes, and snippets.

@mygeekdaddy
Created April 8, 2014 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mygeekdaddy/10161864 to your computer and use it in GitHub Desktop.
Save mygeekdaddy/10161864 to your computer and use it in GitHub Desktop.
DumpToOF
# More information: http://n8henrie.com/2013/03/send-multiple-tasks-to-omnifocus-at-once-with-drafts-and-pythonista
# Script name: MultiLineOmniFocus
# Drafts "URL Action": pythonista://MultiLineOmniFocus?action=run&argv=[[draft]]
# Modified from email script by OMZ: https://gist.github.com/omz/4073599
import smtplib
from email.mime.multipart import MIMEMultipart
from email import encoders
import sys
import webbrowser
import console
def main():
tasks = sys.argv[1].splitlines()
### CHANGE THESE VALUES:
to = 'mygeekdaddy.9trzb@sync.omnigroup.com'
gmail_user = 'jason.verly@gmail.com'
gmail_pwd = 'nfd212aprt1381'
console.clear()
print 'Starting SMTP Server'
smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(gmail_user, gmail_pwd)
for task in tasks:
outer = MIMEMultipart()
outer['Subject'] = task
outer['To'] = to
outer['From'] = gmail_user
outer.preamble = 'You will not see this in a MIME-aware email reader.\n'
composed = outer.as_string()
print 'Sending Task ' + str(tasks.index(task) + 1)
smtpserver.sendmail(gmail_user, to, composed)
smtpserver.close()
print 'Done'
console.clear()
if __name__ == '__main__':
main()
webbrowser.open('drafts://')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment