Undelivered Mail Returned to Sender

45 views
Skip to first unread message

Precious Imoniakemu

unread,
Jun 14, 2023, 8:18:20 AM6/14/23
to Django users
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
                to_email_ = 'ad...@domainname.com'

                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_HOST = os.getenv('EMAIL_HOST') #mail.privateemail.com
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.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients.

Steven Lizhi

unread,
Jun 15, 2023, 9:33:02 AM6/15/23
to django...@googlegroups.com
Maybe you can use email cc param to send more email users.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d77e903b-b210-43b0-9315-49abf082c60bn%40googlegroups.com.

Lucifer Black

unread,
Jun 17, 2023, 10:09:55 AM6/17/23
to django...@googlegroups.com
thank you!! 


From: django...@googlegroups.com <django...@googlegroups.com> on behalf of Steven Lizhi <nice....@gmail.com>
Sent: Wednesday, June 14, 2023 9:17:21 PM
To: django...@googlegroups.com <django...@googlegroups.com>
Subject: Re: Undelivered Mail Returned to Sender
 

ivan harold

unread,
Aug 9, 2023, 10:21:19 AM8/9/23
to Django users
Check this one maybe this can help.
https://docs.djangoproject.com/en/1.10/topics/email/#django.core.mail.EmailMessage

and also this

class Client(models.Model): bcc = models.TextField(null=True, blank=True)

from django.core.mail import EmailMessage clients= Client.objects.all() for client in clients: subject = client.subject content = client.body contact_email = client.msg_from to = client.msg_to bcc_mails = client.bcc bcc = bcc_mails.split(",") bcc_mails.replace('"', "") email = EmailMessage( subject, content, contact_email, [to], bcc, headers={'Reply-To': contact_email} )

Reply all
Reply to author
Forward
0 new messages