Esempio n. 1
0
def send_confirm_message(email, token, lang, message_type):
    lang = lang.strip()
    lang = lang or "en-US"
    message_id = f"newsletter-confirm-{message_type}"
    vid = AcousticTxEmailMessage.objects.get_vendor_id(message_id, lang)
    if vid:
        acoustic_tx.send_mail(email, vid, {"basket_token": token}, save_to_db=True)
Esempio n. 2
0
def process_donation_receipt(data):
    # filter out any extra data
    message_data = {k: v for k, v in data.items() if k in DONATION_RECEIPT_FIELDS}
    email = message_data.pop("email")
    created = message_data.pop("created")
    created_dt = mofo_donation_receipt_datetime(created)
    message_data["created"] = mofo_donation_receipt_time_string(created_dt)
    message_data["day_of_month"] = mofo_donation_receipt_day_of_month(created_dt)
    recurring = message_data.pop("recurring")
    message_data["payment_frequency"] = "Recurring" if recurring else "One-Time"
    message_data["donation_amount"] = mofo_donation_receipt_number_format(
        message_data["donation_amount"],
    )
    message_data["friendly_from_name"] = (
        "MZLA Thunderbird" if message_data["project"] == "thunderbird" else "Mozilla"
    )

    # convert some field names
    send_data = {
        DONATION_RECEIPT_FIELDS_MAP.get(k, k): v for k, v in message_data.items()
    }
    message_id = AcousticTxEmailMessage.objects.get_vendor_id(
        "donation-receipt", data.get("locale", "en-US"),
    )
    if message_id:
        acoustic_tx.send_mail(
            email,
            message_id,
            send_data,
            bcc=settings.DONATE_RECEIPTS_BCC,
            save_to_db=True,
        )
Esempio n. 3
0
def send_recovery_message_acoustic(email, token, lang, fmt):
    message_name = "account-recovery"
    if fmt != "H":
        message_name += "-text"

    vid = AcousticTxEmailMessage.objects.get_vendor_id(message_name, lang)
    if vid:
        acoustic_tx.send_mail(email, vid, {"basket_token": token})
Esempio n. 4
0
def send_acoustic_tx_message(email, vendor_id, fields=None):
    acoustic_tx.send_mail(email, vendor_id, fields)