Skip to content

Commit

Permalink
Added Email Invitation example
Browse files Browse the repository at this point in the history
  • Loading branch information
jmah committed Jun 1, 2010
1 parent 4b66497 commit d2b5901
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions examples/Email Invitation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/python

from __future__ import with_statement # For Python < 2.6

import sys, smtplib, cinesync
from email.mime.text import MIMEText

with cinesync.EventHandler() as evt:
if evt.is_offline(): sys.exit()

join_url = cinesync.commands.join_session_url(evt.session_key)
msg = MIMEText("Come join my cineSync session! Just click here: <%s>\n" % join_url)
msg["From"] = sys.argv[2]
msg["To"] = sys.argv[3]
msg["Subject"] = "Join my cineSync session: %s" % evt.session_key

s = smtplib.SMTP()
s.connect(sys.argv[1])
s.sendmail(msg["From"], msg["To"], msg.as_string())
s.close()

0 comments on commit d2b5901

Please sign in to comment.