HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Private Message email template location?

AoleeAolee Hobbyist & Coder ✭✭


I've tried grepping and also checking the translation file but cant find the email template for the private message.

EmailStoryNotification seems not being used in for sending private message.

Sample template im receiving:

User1 sent you a message

<body of message>

Reply: https:/xxxxxx


  • Options
    R_JR_J Ex-Fanboy Munich Admin

    You can read about Vanillas email templates and how to override (not over-write!) them in the docs: https://docs.vanillaforums.com/developer/framework/email/

  • Options
    AoleeAolee Hobbyist & Coder ✭✭

    Hi @R_J sorry for the confusion. Let me explain further.

    when someone sends a private message. you also get notified via email. however I dont want to include the content of the message in the email.

    The Forum name https://the forum.com
    user1 sent you a message
    Yea Boy
    Reply: https://theforum.com/messages/33103#Message_238870

    I wanted to remove the actual message "Yea boy" from the email. leaving my members to click the link to see the message.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    There is no such thing like a mail template for activity X and another mail template for activity Y. If some event happens that initiates an activity, that activity is queued and then a notification is sent and an email.

    All emails use one and the same template and only subject, body and button text are set based on the activity.

    If you want to change some of them, you need to hook into the mail sending process and change what is passed to the mail template. That can be achieved with a plugin (or in a themehooks file) like that:

       public function activityModel_beforeSendNotification_handler($sender, $args) {
           // Ensure we only change mails for conversation messages.
           if ($args['Activity']['ActivityType'] != 'ConversationMessage') {
           // Get "original" mail.
           $emailTemplate = $args['Email']->getEmailTemplate();
           // Optionally: set the subject.
           // $emailTemplate->setTitle('All your base are belong to us');
           // Optionally: set sub title.
           // $emailTemplate->setLead('Whatever');
           // Change message body to whatever you like
           $emailTemplate->setMessage('Visit my cool site to read that message', true);
           // Optionally: change button, but you most probably only want to change
           // the text and that should be done with translating "Check it out".
           // $url = externalUrl(val('Route', $args['Activity']) == '' ? '/' : val('Route', $args['Activity']));
           // $emailTemplate->setButton($url, val('ActionText', $activity, t('Check it out')))
           // Optionally: change footer.
           // $emailTemplate->setFooter('Ugliest footer in the world, '#00ff00', '#ff0000');
           // Apply new template.

  • Options
    AoleeAolee Hobbyist & Coder ✭✭

    OH! Thanks a lot @R_J for this ! Problem solved. :)

Sign In or Register to comment.