mail o zachecie do logowania
This commit is contained in:
20
app.py
20
app.py
@ -281,7 +281,7 @@ def get_smtp_config():
|
||||
|
||||
return config
|
||||
|
||||
def send_email_batch(users, smtp_config, mails_per_pack=100, time_per_pack=60, dry_run=False):
|
||||
def send_email_batch(users, smtp_config, mails_per_pack=100, time_per_pack=60, dry_run=False, template_path="mail_template.html"):
|
||||
import os
|
||||
|
||||
template_path = "mail_template.html"
|
||||
@ -431,6 +431,10 @@ def main():
|
||||
parser.add_argument('--stats', action='store_true',
|
||||
help='Wyświetl statystyki: aktywność, rok rejestracji, domeny')
|
||||
|
||||
parser.add_argument('--mail-template', type=str,
|
||||
help='Ścieżka do alternatywnego pliku HTML z szablonem maila (domyślnie: mail_template.html)')
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
inactive_range = None
|
||||
@ -449,7 +453,14 @@ def main():
|
||||
'created': int(datetime.now().timestamp()) - (86400 * 365 * 2)
|
||||
}
|
||||
print(f"📬 Wysyłka testowego maila na: {test_user['mail']}")
|
||||
send_email_batch([test_user], smtp_config, mails_per_pack=1, time_per_pack=0, dry_run=False)
|
||||
send_email_batch(
|
||||
[test_user],
|
||||
smtp_config,
|
||||
mails_per_pack=1,
|
||||
time_per_pack=0,
|
||||
dry_run=False,
|
||||
template_path=args.mail_template
|
||||
)
|
||||
return
|
||||
|
||||
if not args.drupal_path:
|
||||
@ -458,7 +469,6 @@ def main():
|
||||
if not args.delete and args.dry_run is None:
|
||||
args.dry_run = True
|
||||
|
||||
|
||||
if args.flush_cache:
|
||||
flush_redis_cache()
|
||||
return
|
||||
@ -598,9 +608,11 @@ def main():
|
||||
smtp_config,
|
||||
args.mails_per_pack,
|
||||
args.time_per_pack,
|
||||
dry_run=args.dry_run
|
||||
dry_run=args.dry_run,
|
||||
template_path=args.mail_template
|
||||
)
|
||||
|
||||
|
||||
print("\n📋 Parametry filtrowania:")
|
||||
if args.days_inactive:
|
||||
print(f"- Nieaktywni: > {args.days_inactive} dni (~{days_to_years(args.days_inactive)} lat)")
|
||||
|
Reference in New Issue
Block a user