Skip to content

Instantly share code, notes, and snippets.

@gibron
Last active August 29, 2015 14:01
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 gibron/68e9f5bb76ab28768855 to your computer and use it in GitHub Desktop.
Save gibron/68e9f5bb76ab28768855 to your computer and use it in GitHub Desktop.
Generate Test Email
from lfcore.conv.models import CommentOpine
from lfcore.notification.tasks.notification_email_compile import create_email
from lfcore.common.tasks import email
import pdb;pdb.set_trace()
ntype = 'like'
comment = Comment.objects.all()[0]
conv = Conv.objects.all()
conv = conv[0]
domain = Domain.objects.filter(name__contains="la-nacion-int")[0]
user = UserProfile.objects.all()[0]
mail_from = "NEWSINT@livefyre.com"
opine = CommentOpine(comment=comment, conv=conv, user=user, opinion_type=OpinionType.objects.get(pk=1))
note = { 'type': ntype, 'conv': conv, 'comment': comment, 'opine': opine }
template_name = domain.json_config.get('email_template')
template_params = domain.json_config.get('email_template_params')
(subject, body_plain, body_html) = create_email(user,[note], template_name, template_params)
# for mocking in something other than what's currently in production, you can reassign body_html here
#email.send.delay(mail_from, "gibron@livefyre.com", subject, body_plain, body_html)
<html><head>\n<style type="text/css">\n.title span a:hover { color: #737373 !important; text-decoration: none !important; }\n</style>\n</head>\n<body style="font-family: Arial, sans-serif; color: #464646;">\n<!-- json_config: {&quot;global&quot;: &quot;often&quot;, &quot;sites&quot;: {}} -->\n<div class="title" style="margin-bottom: 1em;">\n<table style="width: 100%; font-size: 10pt;">\n<tr><td><a style="text-decoration: none;" href="http://money.cnn.com"><h2 style="font-size: 1.2em; color: #252525; margin: 0;">"Should Tiger lose his endorsement deals?"</h2></a>\n<span style="font-weight: lighter; color: #939393; display: block;"><a href="http://money.cnn.com" class="blogurl" style="color: #939393; text-decoration: none;">http://money.cnn.com</a></span>\n<span style="color: #939393; margin-top: 1em; display: block;">Dejar de recibir notificaciones de esta conversaci&oacute;n&nbsp;<a href="https://registracion.lanacion.com.ar/mis-datos" style="text-decoration: none; color: #2c87dd; ">Dejar de seguir</a></span>\n</td><td style="text-align: right; vertical-align: top;"><img src="" /></td></tr>\n</table>\n</div>\n<table cellspacing="0" id="container" style="font-size: 12pt; table-layout: fixed; width: 100%;" cellpadding="0">\n<tr id="multisection"><td>\n<table id="likes" style="width: 100%;">\n\n<tr><td>\n<table class="like" style="width: 100%; margin-bottom: .15em; border: 1px solid #e6f9e6;">\n<tr class="bar">\n<td class="intro" style="padding: 0.8em; background: #e6f9e6; font-weight: bold; font-size: .8em;"><a href="http://money.cnn.com?hubRefSrc=email#lf_comment=2" style="color: #464646; text-decoration: none;">A henryarlander le gust&oacute; tu comentario</a><span class="ago" style="margin-left: 1.1em; font-weight: lighter; color: #8e8e8e;"></span></td>\n</tr>\n<tr>\n<td class="message" style="font-size: .8em; padding: .5em .5em 0 .5em;"><p style="margin: 0 0 1em 0;">Should Tiger lose his endorsement deals?</p></td>\n</tr>\n<tr>\n<td class="gotolink" style="font-size: .8em; padding: 0em .5em .5em .5em;"><span class="gotocomment"><a href="http://money.cnn.com?hubRefSrc=email#lf_comment=2" class="green link" style="text-decoration: none; color: #84be67;">Ir al comentario</a></span></td>\n</tr>\n</table>\n</td></tr>\n\n</table>\n</td></tr>\n</table><div class="footer" style="margin: 1em 4px 0 4px;">\n\t\t<table style="width: 100%;" class="social-links" cellspacing="0" cellpadding="0" border="0">\n\t\t\t<tr style="background-color: #f2f2f2; font-family: sans-serif; font-size: 14px; line-height: 35px;">\n\t\t\t\t<td>\n\t\t\t\t\t<p style="padding: 0 0 0 10px; margin: 0;">\n\t\t\t\t\t\t<span style="font-size: 12px;"><a style="color: #f8852d; text-decoration: none;" href="http://livefyre.com/comments/">Get Livefyre for FREE</a><a href="http://livefyre.com"><img src="http://www.t402.livefyre.com/site_media/images/emails/livefyre.png" alt="Get Livefyre for your blog - FREE" style="vertical-align: middle; margin-left: 4px; height: 24px; width: 24px;" /></a></span>\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t\t<td style="text-align: right;">\n\t\t\t\t\t<p style="padding: 0 10px 0 0; margin: 0;">\n\t\t\t\t\t\t<a href="http://facebook.com/livefyre" style="color: #f8852d; text-decoration: none;"><img alt="Like Livefyre on Facebook" style="vertical-align: middle; margin-left: 4px; height: 24px; width: 24px;" src="http://www.t402.livefyre.com/site_media/images/emails/facebook.png" />\n\t\t\t\t\t\t<a href="http://twitter.com/livefyre" style="color: #f8852d; text-decoration: none;"><img alt="Follow @Livefyre on Twitter" style="vertical-align: middle; margin-left: 4px; height: 24px; width: 24px;" src="http://www.t402.livefyre.com/site_media/images/emails/twitter.png" />\n</a>\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\t\t<p style="font-size: .8em; color: #9A9A9A;"><a href="http://quill.t402.livefyre.com/unfollow/email/?hash=MjE4LDFAcm9vbXMubGl2ZWZ5cmUuY29tLDE0MDAyMjQ2OTAuMCxlZmRiYTZiMTU5OTI5ZjU2MzRiMDY4MzI1NGM5MmEzNGIyZWQ4ZDA2" class="link" style="color: #2c87dd; text-decoration: none;">Unsubscribe</a> from this conversation | View or change your <a href="http://www.t402.livefyre.com/profile/edit/notifications" class="link" style="color: #2c87dd; text-decoration: none;">notification settings</a> across all conversations | Learn more <a href="http://livefyre.com" class="link" style="color: #2c87dd; text-decoration: none;">about Livefyre</a> | A robot sent this email, but she can\'t read, so <a href="http://www.livefyre.com/contact/" class="link" style="color: #2c87dd; text-decoration: none;">contact us</a> to talk to a human</p>\n\t</div>\n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment