User profile pages should have a link to send a message to a user. This would send an email to their primary email address on record (if an email address is set). Similar to SourceForge's old https://sourceforge.net/sendmessage.php?touser=2904855
The sender address should be the actual email address of the sender, so that the recipient may reply.
We should include rate limiting so that a user cannot send too many messages. The old SF one has rate limiting implemented as: a mongo collection that stores {_id: user id, times: [array of times when messages sent]} and 2 config values for max # of messages and time interval. When accessing the form or posting the form, check to see if the times array and delete any older than the config interval, if the size of the array is larger than the config max # messages, show an error to the user. When posting the form successfully, append a new timestamp to the 'times' array.
Include an option to CC the sender.
Diff:
Created #461: [#6694] Form to send message to a user (2cp)
Related
Tickets:
#6694Closed #461.
je/42cc_6694
Two new options
user_message.time_interval
anduser_message.max_messages
(see development.ini)Also, please take a closer look to commit [e9bb84]. It's quick fix for email 'To:' header in case you send message to only one destination address (without this you'd get 'To:' and 'From:' equal to each other, which is misleading for the end user). I wonder maybe we should refactor
sendmail
accordingly to what comment suggests?