Stranger6667 / postmarker

Python client library for Postmark API
https://postmarker.readthedocs.io/en/stable/
MIT License
134 stars 29 forks source link

How to provide Content-Type when sending HTML message through a Django application #219

Open Jitendra1965 opened 10 months ago

Jitendra1965 commented 10 months ago

How to provide Content-Type when sending HTML message through a Django application.

I have tried all the combinations, but when the message is delivered to PostmartApp.com, it is being received as text and not html.

If I include content_type='text/html', it doesn't generate any error but it doesnt send the message to PostmartApp

here is the code:

`

from postmarker.django import PostmarkEmailMessage

context = {"message":message
               }

    email = str(sendToEmail)
    toEmail =  email   
    fromField = 'helpdesk@peerreader.com'
    subject = 'Notification of Anonymous Review'
    HtmlBody = render_to_string('ReviewLink/email_message.html', context)

PostmarkEmailMessage(
            subject, #'Subject here'
            HtmlBody, #'Here is the message.'
            fromField, # 'from@example.com'
            [toEmail], #['to@example.com']
            content_type = 'text/html'
            tag='Test tag',

            message_stream="notification"
        ).send()

`

Thanks Jitendra