Module m_mailinglist

Mailinglist model.

Copyright © 2009-2020 Marc Worrell

Behaviours: zotonic_model.

Authors: Marc Worrell (marc@worrell.nl).

Description

Mailinglist model.

Function Index

check_scheduled/1Fetch the next scheduled mailing that are published and in the publication date range.
count_recipients/2
delete_scheduled/3Delete a scheduled mailing.
get_email_from/2Get the "from" address used for this mailing list.
get_enabled_recipients/2Fetch all enabled recipients from a list.
get_recipients_by_email/2Get all recipients with this email address.
get_scheduled/2Get the list of scheduled mailings for a page.
get_stats/2Get the stats for the mailing.
insert_recipient/4Insert a recipient in the mailing list, send a message to the recipient when needed.
insert_recipient/5
insert_recipients/4Replace all recipients of the mailinglist.
insert_scheduled/3Insert a mailing to be send when the page becomes visible.
list_recipients/2List all recipients of a mailinglist (as maps with binary keys, props expanded).
m_get/3Fetch the value for the key from a model source.
normalize_email/1
periodic_cleanup/1Periodically remove bouncing and disabled addresses from the mailinglist.
recipient_confirm/2Confirm the recipient with the given unique confirmation key.
recipient_delete/2Delete a recipient and send the recipient a goodbye e-mail.
recipient_delete/3Delete a recipient by list id and email.
recipient_delete_quiet/2Delete a recipient without sending the recipient a goodbye e-mail.
recipient_get/2Fetch the recipient record for the recipient id.
recipient_get/3Fetch the recipient record by e-mail address.
recipient_is_enabled_toggle/2Toggle the enabled flag of a recipient.
recipient_set_operation/4Perform a set operation on two lists.
recipients_clear/2Clear all recipients of the list.
reset_log_email/3Reset the email log for given list/page combination, allowing one to send the same page again to the given list.
update_recipient/3Update a single recipient; changing e-mail address or name details.

Function Details

check_scheduled/1

check_scheduled(Context) -> any()

Fetch the next scheduled mailing that are published and in the publication date range.

count_recipients/2

count_recipients(ListId::m_rsc:resource_id(), Context::z:context()) -> non_neg_integer()

delete_scheduled/3

delete_scheduled(ListId, PageId, Context) -> any()

Delete a scheduled mailing

get_email_from/2

get_email_from(ListId, Context) -> any()

Get the "from" address used for this mailing list. Looks first in the mailinglist rsc for a ' mailinglist_reply_to' field; falls back to site.email_from config variable.

get_enabled_recipients/2

get_enabled_recipients(ListId::m_rsc:resource_id(), Context::z:context()) -> [binary()]

Fetch all enabled recipients from a list.

get_recipients_by_email/2

get_recipients_by_email(Email, Context) -> any()

Get all recipients with this email address.

get_scheduled/2

get_scheduled(Id, Context) -> any()

Get the list of scheduled mailings for a page.

get_stats/2

get_stats(ListId::m_rsc:resource_id(), Context::z:contex()) -> map()

Get the stats for the mailing. Number of recipients and list of scheduled resources.

insert_recipient/4

insert_recipient(ListId, Email, WelcomeMessageType, Context) -> any()

Insert a recipient in the mailing list, send a message to the recipient when needed.

insert_recipient/5

insert_recipient(ListId, Email, Props, WelcomeMessageType, Context) -> any()

insert_recipients/4

insert_recipients(ListId::m_rsc:resource_id(), Recipients::[binary() | string()] | binary(), IsTruncate::boolean(), Context::z:context()) -> ok | {error, term()}

Replace all recipients of the mailinglist. Do not send welcome messages to the recipients.

insert_scheduled/3

insert_scheduled(ListId, PageId, Context) -> any()

Insert a mailing to be send when the page becomes visible

list_recipients/2

list_recipients(ListId::m_rsc:resource_id(), Context::z:context()) -> {ok, [map()]} | {error, term()}

List all recipients of a mailinglist (as maps with binary keys, props expanded)

m_get/3

m_get(Rest::list(), Msg::zotonic_model:opt_msg(), Context::z:context()) -> zotonic_model:return()

Fetch the value for the key from a model source

normalize_email/1

normalize_email(Email) -> any()

periodic_cleanup/1

periodic_cleanup(Context::z:context()) -> ok

Periodically remove bouncing and disabled addresses from the mailinglist

recipient_confirm/2

recipient_confirm(ConfirmKey::binary(), Context::z:context()) -> {ok, m_rsc:resource_id()} | {error, term()}

Confirm the recipient with the given unique confirmation key.

recipient_delete/2

recipient_delete(RecipientId, Context) -> any()

Delete a recipient and send the recipient a goodbye e-mail.

recipient_delete/3

recipient_delete(ListId, Email, Context) -> any()

Delete a recipient by list id and email

recipient_delete_quiet/2

recipient_delete_quiet(RecipientId, Context) -> any()

Delete a recipient without sending the recipient a goodbye e-mail.

recipient_get/2

recipient_get(RecipientId, Context) -> any()

Fetch the recipient record for the recipient id.

recipient_get/3

recipient_get(ListId, Email, Context) -> any()

Fetch the recipient record by e-mail address

recipient_is_enabled_toggle/2

recipient_is_enabled_toggle(RecipientId, Context) -> any()

Toggle the enabled flag of a recipient

recipient_set_operation/4

recipient_set_operation(Op, IdA, IdB, Context) -> any()

Perform a set operation on two lists. The result of the operation gets stored in the first list.

recipients_clear/2

recipients_clear(ListId::m_rsc:resource_id(), Context::z:context()) -> ok

Clear all recipients of the list

reset_log_email/3

reset_log_email(ListId, PageId, Context) -> any()

Reset the email log for given list/page combination, allowing one to send the same page again to the given list.

update_recipient/3

update_recipient(RcptId, Props, Context) -> any()

Update a single recipient; changing e-mail address or name details.


Generated by EDoc