Skip to content
Advertisement

Too many open connections on sending Email

I’m trying to send email to every users from DB. I use a loop to get the message text per user as I loop need to call the send_email.

But I got an error saying:

I think the problem is that it’s trying to open a connection while it is still open.

What do I need to do to make this work?

Here’s my code:

Sending email, I think this is where I need to modify or but I don’t know what.

Advertisement

Answer

You can use BULK COLLECT. This will fetch all the email ids at once and save it in variable. Then you can process it one by one.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement