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

Attach alternative in post-office? #16

Closed
sanjayankur31 opened this issue Jun 1, 2013 · 7 comments

Comments

Projects
None yet
2 participants
@sanjayankur31
Copy link

commented Jun 1, 2013

Does post-office implement the "attach_alternative" method? We're using it as a the email backed to askbot. We're only getting plain text mails, since askbot attaches the html version using the "attach_alternative" method, but I see a different "html_message" variable in use by post-office. The docs don't mention attach_alternative either.

https://github.com/ASKBOT/askbot-devel/blob/master/askbot/mail/__init__.py
http://stackoverflow.com/a/1414407/375067

@selwin

This comment has been minimized.

Copy link
Collaborator

commented Jun 1, 2013

To send HTML email, you simply need to do:

mail.send(
    # other args
    html_message='<p>Hello world</p>'
)

Internally, post_office uses attach alternative so you don't have to deal with that.

@selwin selwin closed this Jun 1, 2013

@sanjayankur31

This comment has been minimized.

Copy link
Author

commented Jun 3, 2013

Ah! Hrm.. We're using post office as a backend for askbot at askfedora. The mail method already attaches alternatives from what I can make out. The mails are being sent out as plain text and not HTML though. Any hints on why?

Thanks,

@selwin

This comment has been minimized.

Copy link
Collaborator

commented Jun 3, 2013

Ah ok, so askbot uses the lower level msg.send() method instead of post_office's mail.send method.

We should patch post office's EmailBackend.send_messages to detect HTML messages and persist the HTML component in the database accordingly.

This is indeed a bug so I'm gonna reopen this issue. Thanks for reporting it.

@selwin selwin reopened this Jun 3, 2013

@sanjayankur31

This comment has been minimized.

Copy link
Author

commented Jun 3, 2013

Ah! Great. Thanks. I look forward to the fix. :)

@selwin selwin closed this in ee93786 Jun 8, 2013

@sanjayankur31

This comment has been minimized.

Copy link
Author

commented Jun 10, 2013

Thanks for the fix. Would just replacing the backends.py file be sufficient, or would I need to run any other steps to apply this fix?

I replaced the file but the mails are still only plaintext. Still investigating though.

@selwin

This comment has been minimized.

Copy link
Collaborator

commented Jun 10, 2013

Simply replacing backends.py should be sufficient.

@sanjayankur31

This comment has been minimized.

Copy link
Author

commented Jun 13, 2013

Seems to work. Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.