Created
March 24, 2011 20:55
-
-
Save jcarbaugh/885854 to your computer and use it in GitHub Desktop.
create_post method for posting by email with django-cloudmailin
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
def create_post(**message): | |
author = User.objects.get(email=message['from']) | |
title = message['subject'] | |
content = message['plain'] | |
p = Post.objects.create( | |
author=author, | |
title=title, | |
content=content, | |
) | |
send_mail( | |
subject='New blog post created', | |
message='http://example.com/admin/blog/post/%i/\n\n%s' % (p.pk, text), | |
from_email='[email protected]', | |
recipient_list=[message['from']], | |
fail_silently=True | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment