Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Jitendra1965 opened this issue Jan 26, 2024 · 0 comments

Comments

@Jitendra1965
Copy link

Jitendra1965 commented Jan 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant