content,
<span xmlns:kid="http://purl.org/kid/ns#" kid:omit="">
<?python
# Import smtplib for the actual sending function
import smtplib
# Import the email modules we'll need
from email.MIMEText import MIMEText
email = request.parameters.get("email")
message = request.parameters.get("message")
uid = None
session_id = request.session_id
if session_id:
uid = redfoot.value(session_id, SESSION.uid)
assert uid
subject = "testing"
from string import ascii_letters
from random import choice
import md5
token = md5.new()
for i in xrange(0, 10):
token.update(choice(ascii_letters))
FOAF = redfoot.namespace("http://xmlns.com/foaf/0.1/")
DC_creator = URIRef("http://purl.org/dc/elements/1.1/creator")
DC_created = URIRef("http://purl.org/dc/terms/created")
from rdflib.Namespace import Namespace
USER = Namespace("%s/user#" % request.host)
invitation = URIRef(token.hexdigest(), base=request.host)
c = redfoot.get_context(URIRef("#invitations", base=request.host))
c.add((invitation, RDFS.label, Literal("Invitation")))
c.add((invitation, RDF.type, USER.Invitation))
c.add((invitation, FOAF.mbox, URIRef("mailto:%s" % email)))
#c.add((invitation, DC_created, Literal("%s" % time(), datatype=URIRef(REDFOOT.seconds_since_epoch))))
c.add((invitation, DC_creator, URIRef("mailto:%s" % uid)))
message += ("""\
====================
Click on:
%s
""" % invitation)
# Create a text/plain message
msg = MIMEText(message)
msg['Subject'] = subject
msg['From'] = uid
msg['To'] = email
# Send the message via our own SMTP server, but don't include the
# envelope header.
s = smtplib.SMTP()
s.connect()
s.sendmail(uid, [email], msg.as_string())
s.close()
?>
<h2>Your invitation has been sent</h2>
</span>
Comments regarding http://redfoot.net/3.0/aspects/auth_invite/auth_invite_process
Login to submit a comment.