"""Service layer for the Mail plugin — pure re-export facade. All implementation lives in focused sub-modules: accounts.py — create/update mail account service crypto.py — AES-256 password encryption (Fernet) drafts_sync.py — draft save/update, auto-sync, sync queue processing imap_ops.py — IMAP flag sync, delete, move, folder create/delete imap_sync.py — folder sync, account sync, thread-id, quota parser pgp.py — PGP key import, encrypt/decrypt messages sanitize.py — nh3 HTML sanitization serializers.py — response dict builders for all ORM models smtp_send.py — send via SMTP, reply, forward text_utils.py — extract email addresses, strip HTML """ import logging from app.plugins.builtins.mail.accounts import ( create_mail_account, update_mail_account, ) from app.plugins.builtins.mail.attachments import ( # noqa: F401 — routes.py re-exports MAX_ATTACHMENT_SIZE, _attachment_storage_path, _decode_mime_filename, _sanitize_filename, _save_attachment_to_storage, ) from app.plugins.builtins.mail.crypto import ( decrypt_password, encrypt_password, generate_salt, ) from app.plugins.builtins.mail.drafts_sync import ( auto_sync_all_accounts, imap_create_folder, # noqa: F401 — routes.py re-export imap_delete_folder, # noqa: F401 — routes.py re-export process_sync_queue, save_draft, update_draft, ) from app.plugins.builtins.mail.imap_ops import ( imap_delete_mail, imap_move_mail, imap_sync_mail_flags, ) from app.plugins.builtins.mail.imap_sync import ( _compute_thread_id, _get_german_folder_name, _parse_imap_list_response, _parse_imap_quota_response, get_account_password, imap_sync_account, imap_sync_folder, ) from app.plugins.builtins.mail.models import ( Mail, MailAccount, MailAttachment, MailFolder, MailLabel, MailLabelAssignment, MailRule, MailSignature, MailTemplate, VacationSentLog, ) from app.plugins.builtins.mail.pgp import ( import_pgp_private_key, import_pgp_public_key, pgp_decrypt_message, pgp_encrypt_message, ) from app.plugins.builtins.mail.rules_vacation import ( apply_rules_to_mail, execute_rule_actions, log_vacation_sent, matches_condition, should_send_vacation_reply, substitute_template_vars, ) from app.plugins.builtins.mail.sanitize import sanitize_html from app.plugins.builtins.mail.serializers import ( account_to_response, attachment_to_response, folder_to_response, label_to_response, mail_to_response, # noqa: F401 rule_to_response, signature_to_response, template_to_response, ) from app.plugins.builtins.mail.smtp_send import ( forward_mail, reply_to_mail, send_mail_via_smtp, ) from app.plugins.builtins.mail.text_utils import ( _strip_html, extract_email_addresses, ) logger = logging.getLogger(__name__) __all__ = [ # accounts "create_mail_account", "update_mail_account", "account_to_response", # crypto "decrypt_password", "encrypt_password", "generate_salt", # drafts & sync "auto_sync_all_accounts", "process_sync_queue", "save_draft", "update_draft", # imap ops "imap_delete_mail", "imap_move_mail", "imap_sync_mail_flags", # imap sync "_compute_thread_id", "_get_german_folder_name", "imap_sync_account", "imap_sync_folder", "get_account_password", "_parse_imap_list_response", "_parse_imap_quota_response", # models "Mail", "MailAccount", "MailAttachment", "MailFolder", "MailLabel", "MailLabelAssignment", "MailRule", "MailSignature", "MailTemplate", "VacationSentLog", # pgp "import_pgp_private_key", "import_pgp_public_key", "pgp_decrypt_message", "pgp_encrypt_message", # rules & vacation "apply_rules_to_mail", "execute_rule_actions", "log_vacation_sent", "matches_condition", "should_send_vacation_reply", "substitute_template_vars", # sanitize "sanitize_html", # serializers "attachment_to_response", "folder_to_response", "label_to_response", "rule_to_response", "signature_to_response", "template_to_response", # smtp send "forward_mail", "reply_to_mail", "send_mail_via_smtp", # text utils "_strip_html", "extract_email_addresses", ]