def handle(self, *args, **options): exclude_startswith = options['exclude_startswith'] filter_startswith = options['filter_startswith'] queryset = EmailSubscriber.objects.filter(newsletter=True) if exclude_startswith: queryset = queryset.exclude(email__startswith=exclude_startswith) if filter_startswith: queryset = queryset.filter(email__startswith=filter_startswith) queryset = queryset.order_by('email') email_list = set(queryset.values_list('email', flat=True)) print("got {} emails".format(len(email_list))) counter = 0 for to_email in email_list: counter += 1 print("-sending {} / {}".format(counter, to_email)) if options['live']: try: weekly_roundup([to_email]) time.sleep(1) except Exception as e: print(e) time.sleep(5)
def handle(self, *args, **options): days_back = 90 email_list = [] # todo: tip emails # mailchimp emails # whitepaper dev emails bounties = Bounty.objects.filter(web3_created__gt=timezone.now()-timezone.timedelta(days=days_back)).all() for b in bounties: if b.bounty_owner_email: email_list.append(b.bounty_owner_email) if b.claimee_email: email_list.append(b.claimee_email) email_list = set(email_list) print(email_list) print("got {} emails".format(len(email_list))) #TODO: formalize the list management into its own database table, completely with ability to manage subscriptions for to_email in email_list: weekly_roundup([to_email])
def handle(self, *args, **options): exclude_startswith = options['exclude_startswith'] filter_startswith = options['filter_startswith'] start_counter = options['start_counter'] queryset = EmailSubscriber.objects.all() if exclude_startswith: queryset = queryset.exclude(email__startswith=exclude_startswith) if filter_startswith: queryset = queryset.filter(email__startswith=filter_startswith) queryset = queryset.order_by('email') email_list = list(set(queryset.values_list('email', flat=True))) # list.sort(email_list) print("got {} emails".format(len(email_list))) counter = 0 for to_email in email_list: counter += 1 # skip any that are below the start counter if counter < start_counter: continue print("-sending {} / {}".format(counter, to_email)) if options['live']: try: if check_already_sent and is_already_sent_this_week( to_email): print(' -- already sent') else: weekly_roundup([to_email]) time.sleep(0.05) except Exception as e: print(e) time.sleep(5)
def handle(self, *args, **options): b = Bounty.objects.all().last() i = Interest.objects.all().last() # new_bounty(b, [settings.CONTACT_EMAIL]) # new_match([settings.CONTACT_EMAIL, '*****@*****.**'], b, 'owocki') weekly_roundup([settings.CONTACT_EMAIL])