How to fix smtp connection issue in mail sending?

47 views Asked by At

In my erpnext application I need to send bulk email and I am using smtp.gmail.com. The number vary up to 1000. I can see system can send around 100 email successfully and then getting Invalid Outgoing Mail Server or Port. Further deep diving I can see mail exception in smtp login and message is: Connection unexpectedly closed from frappe SMTP

Problem found only in server (dev, live) but works fine in my local machine.

Following mail sending code is running inside a for loop.

frappe.enqueue(
                queue="short",
                method=frappe.sendmail,
                recipients=get_recipients(context.get('email')),
                [email protected],
                subject=frappe.render_template(
                    email_template.subject, context),
                message=message,
                now=False,
            )
0

There are 0 answers