Created
April 8, 2014 17:45
-
-
Save mygeekdaddy/10161864 to your computer and use it in GitHub Desktop.
DumpToOF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = '[email protected]' | |
gmail_user = '[email protected]' | |
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