68
def send_welcome_message(mlist, address, language, delivery_mode, text=''):
68
def send_welcome_message(mlist, member, language, text=''):
69
69
"""Send a welcome message to a subscriber.
71
71
Prepending to the standard welcome message template is the mailing list's
72
72
welcome message, if there is one.
74
:param mlist: the mailing list
74
:param mlist: The mailing list.
75
75
:type mlist: IMailingList
76
:param address: The address to respond to
78
:param language: the language of the response
76
:param member: The member to send the welcome message to.
77
:param address: IMember
78
:param language: The language of the response.
79
79
:type language: ILanguage
80
:param delivery_mode: the type of delivery the subscriber is getting
81
:type delivery_mode: DeliveryMode
83
welcome_message = _get_message(mlist.welcome_message_uri,
85
# Find the IMember object which is subscribed to the mailing list, because
86
# from there, we can get the member's options url.
87
member = mlist.members.get_member(address)
88
user_name = member.user.display_name
81
welcome_message = _get_message(mlist.welcome_message_uri, mlist, language)
89
82
options_url = member.options_url
90
83
# Get the text from the template.
91
84
text = expand(welcome_message, dict(
92
85
fqdn_listname=mlist.fqdn_listname,
93
86
list_name=mlist.display_name,
94
#listinfo_uri=mlist.script_url('listinfo'),
95
87
list_requests=mlist.request_address,
88
user_name=member.user.display_name,
89
user_address=member.address.email,
98
90
user_options_uri=options_url,
100
if delivery_mode is not DeliveryMode.regular:
92
if member.delivery_mode is not DeliveryMode.regular:
101
93
digmode = _(' (Digest mode)')
104
96
msg = UserNotification(
105
formataddr((user_name, address)),
97
formataddr((member.user.display_name, member.address.email)),
106
98
mlist.request_address,
107
99
_('Welcome to the "$mlist.display_name" mailing list${digmode}'),