postmarker icon indicating copy to clipboard operation
postmarker copied to clipboard

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

Open Jitendra1965 opened this issue 1 year ago • 0 comments

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 = '[email protected]'
    subject = 'Notification of Anonymous Review'
    HtmlBody = render_to_string('ReviewLink/email_message.html', context)
    
PostmarkEmailMessage(
            subject, #'Subject here'
            HtmlBody, #'Here is the message.'
            fromField, # '[email protected]'
            [toEmail], #['[email protected]']
            content_type = 'text/html'
            tag='Test tag',
            
    
            message_stream="notification"
        ).send()

`

Thanks Jitendra

Jitendra1965 avatar Jan 26 '24 01:01 Jitendra1965