invoice_html = html2pdf('product/invoice.html', context)
subject = 'Invoice for your order'
message = 'Please find attached the invoice for your order. This is a no reply mail but you can contact us through sup...@domainname.com for any enquiry.' from_email = settings.EMAIL_HOST_USER
to_email = order.email
# Convert invoice_html to a File object
invoice_file = BytesIO(invoice_html)
email = EmailMessage(subject, message, from_email, [to_email])
email.attach(
'invoice.pdf', invoice_file.getvalue(), 'application/pdf')
email.send()
subject_ = 'Notice for an order'
message_ = f'Please find notice information for { order.full_name } new order.'
from_email_ = settings.EMAIL_HOST_USER
notice = EmailMessage(subject_, message_,
from_email_, [to_email_])
notice.attach(
'invoice.pdf', invoice_file.getvalue(), 'application/pdf')
notice.send()
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_PORT = os.getenv('EMAIL_PORT') #465
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD')
EMAIL_USE_TLS = False
EMAIL_USE_SSL = True
I tried sending mail to from my privateemail i got from namecheap to gmail but it gives thr content below:
This is the mail system at host mailout-pe-b.jellyfish.systems.