Hi guys,

I'm implementing a view which sends a (nightly) status report email.
The code works mostly fine. I can both receive the email and see the
result rendered as I query the view. The HTML shown and emailed is
gotten from the same response object. However, the links included in
the report only work in the browser view, but not in the email. For
the email, the links are rendered with a default prefix of "http://";,
and they are missing the domain name and https protocol specifier.
I've been digging, but so far unable to find any reason why the prefix
should be lost between two lines of code.

Here are the relevant parts of my functions:

def send_daily(request):
    ...

    response = render_to_response('email/status.html',
        { ... a bunch of context stuff ... })
    send_email('Daily project status', 'sen...@nowhere.not',
'recei...@nowhere.not',
        'This report can only be viewed in HTML, which appears not to
be supported by your email client.',
        response._get_content())
    return response

def send_email(subject, from_email, to, text, html):
    msg = EmailMultiAlternatives(subject, text, from_email, [to])
    msg.attach_alternative(html, "text/html")
    msg.send()

Thanks for any hints.

-- Eki

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to