mailing do wszystkich
This commit is contained in:
25
app.py
25
app.py
@@ -524,9 +524,14 @@ def main():
|
||||
parser.add_argument('--search-user', metavar="USERNAME",
|
||||
help='Wyszukaj użytkownika po nazwie i wyświetl jego statystyki')
|
||||
|
||||
parser.add_argument('--mailing-all-users', action='store_true',
|
||||
help='Wyślij mailing do wszystkich użytkowników z poprawnym adresem e-mail')
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
inactive_range = None
|
||||
|
||||
if args.inactive_since:
|
||||
try:
|
||||
min_days, max_days = map(int, args.inactive_since.split('-'))
|
||||
@@ -639,6 +644,26 @@ def main():
|
||||
|
||||
final_candidates = [u for u in final_candidates if (u.get('points') or 0) == 0]
|
||||
|
||||
if args.mailing_all_users:
|
||||
users = get_users(db_config)
|
||||
temp_domains_cache = load_temp_domains()
|
||||
candidates = [
|
||||
u for u in users
|
||||
if (not is_fake_email(u['mail'])) and (not is_temp_email(u['mail'], temp_domains_cache))
|
||||
]
|
||||
|
||||
print(f"📨 Wysyłanie mailingu do {len(candidates)} użytkowników z poprawnym adresem e-mail...")
|
||||
|
||||
send_email_batch(
|
||||
candidates,
|
||||
smtp_config,
|
||||
args.mails_per_pack,
|
||||
args.time_per_pack,
|
||||
dry_run=args.dry_run,
|
||||
template_path=args.mail_template
|
||||
)
|
||||
return
|
||||
|
||||
if args.stats:
|
||||
from collections import Counter
|
||||
|
||||
|
Reference in New Issue
Block a user