Skip to content

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

@Jitendra1965

Description

@Jitendra1965

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions