How to send bulk invitation email to Open Edx plattfrom users not the enrolled course users?

Hello I would like to ask if it possible to sent email to users of the open edx plattform that are not enrolled on a course in order to invite them. Not to auto enroll them.
Is there a way extract a csv with the emails that are not registered and to send the email only to them?
@antoviaque @regis @cacciaresi @giovannicimolin @idegtiarov @Manish_Hada @nedbat do you have any idea how can i do that?

Additionally we have about 519 users who are inactive. So we should send them bulk email to activate

Thank you in advance

Hi @nadiastef,
if I understand correctly, you would like to email ALL Open edX users that have registered on your platform. Is that correct?
If this is not a case, you can refer to this section of docs to see how you can download a CSV of learners who can enroll.

If it is a case, though, I’m not aware of such option existing natively. However it’s possible to this semi-automatically.
You can extract your users’ emails with Django shell like this:

from django.contrib.auth.models import User
with open('emails.csv', 'w') as csv:
    for user in User.objects.all():
        csv.write("{}\n".format(user.email))

Then you can use the method described in this part of the docs (without checking the Auto Enroll option) to invite users to the course and used the method described above (downloading a CSV of learners who can enroll) to track enrollment status.