title: Facing errors while using Django post office setup for sending mails
body: <p><strong>Issue</strong>
  Error is due to attachments folder(post_office_attachments) not being able to generate on linux server.</p>
  <p><strong>Error</strong></p>
  <p>TypeError at /dev/generate_request/
  Object of type 'TypeError' is not JSON serializable
  Request Method: POST
  Django Version: 2.2.3
  Exception Type: TypeError
  Exception Value:<br />
  Object of type 'TypeError' is not JSON serializable
  Exception Location: /usr/lib/python3.6/json/encoder.py in default, line 180
  Python Executable:  /usr/bin/python3</p>
  <p><strong>Related Code</strong></p>
  <p>try:</p>
  <pre><code>html = template.render(context) 
  
  email_message = EmailMultiAlternatives(subject, html, from_email, [to_email])
      
  email_message.attach_alternative(html, 'text/html')
      
  template.attach_related(email_message)
      
  email_message.send()
      
  return &quot;success&quot; 
  </code></pre>
  <p>except Exception as e:</p>
  <pre><code>return &quot;Error: unable to send email due to&quot; + e
  </code></pre>
  <p><strong>Which piece of code is causing the error</strong></p>
  <p>template.attach_related(email_message)</p>