def email_owner_on_comment(sender, comment, request, *args, **kwargs):
    from django.core.mail import EmailMultiAlternatives
    snipt = Snippet.objects.get(id=request.POST['object_pk'])
    if snipt.user.username != comment.name:
        text_content = """
            %s has posted a comment on your snipt "%s" at http://snipt.net%s#comment-%s.
        
            Just thought you'd like to know!
        
            The Snipt team at Lion Burger.
        """ % (comment.name, snipt.description, snipt.get_absolute_url(), comment.id)
        html_content = """
            <a href="http://snipt.net/%s">%s</a> has posted a comment on your snipt "<a href="http://snipt.net%s#comment-%s">%s</a>".<br />
            <br />
            Just thought you'd like to know!<br />
            <br />
            The <a href="http://snipt.net">Snipt</a> team at <a href="http://lionburger.com">Lion Burger</a>.
        """ % (comment.name, comment.name, snipt.get_absolute_url(), comment.id, snipt.description)
        msg = EmailMultiAlternatives("""A new comment on "%s".""" % snipt.description, text_content, 'Snipt <info@snipt.net>', [snipt.user.email])
        msg.attach_alternative(html_content, "text/html")
        msg.send()
dataset/ETHPy150Open nicksergeant/snipt-old/views.py/email_owner_on_comment/original