Advertisement:

Author Topic: How to remove Message text in Email notifications for Private Messages?  (Read 2148 times)

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 28
    • studio five
I have "Don't allow post text in notifications" checked in Features and Options.
When sending notifications about new posts the post text does not display.
However, when receiving notifications of new Private Messages the message text displays in the email.
I am using SMF 2.0.15.
I had eNotify installed but have removed it. It was causing redirection problems after logging in.
This is a private forum. I do not want message text in notifications to members.
Please advise.
Thanks.
« Last Edit: May 16, 2019, 07:27:08 AM by RGMears »

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,316
  • Gender: Male
    • Kindred-999 on GitHub
Re: Email notification customization
« Reply #1 on: May 16, 2019, 07:12:57 AM »
Please start your own topic,  especially since your question is different from the original thread.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 28
    • studio five
done

Offline a10

  • Charter Member
  • Sr. Member
  • *
  • Posts: 855
Try using search, lots of info posted.

Example https://www.simplemachines.org/community/index.php?topic=560975.0
2.0.15, ssl, php 7.1.31, MySQL 10.3.13-MariaDB~bionic
Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 28
    • studio five
I have searched this Topic extensively. And I came across the thread you linked to. It seemed somewhat unresolved which is why I started this.

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,969
the below message from that topic has the steps you need to follow. what you want done, cannot be completed without a code edit.

PersonalMessage.english.php

Find this -

Code: [Select]

// Don't translate SENDER or MESSAGE in this language string; they are replaced with the corresponding text - use numeric entities too.
$txt['pm_email'] = 'You have just been sent a personal message by SENDER on ' . $context['forum_name'] . '.' . "\n\n" . 'IMPORTANT: Remember, this is just a notification. Please do not reply to this email.' . "\n\n" . 'The message they sent you was:' . "\n\n" . 'MESSAGE';
$txt['pm_multiple'] = '(multiple recipients: \'name1, name2\')';


Change to this -

Code: [Select]

// Don't translate SENDER or MESSAGE in this language string; they are replaced with the corresponding text - use numeric entities too.
$txt['pm_email'] = 'You have just been sent a personal message by SENDER on ' . $context['forum_name'] . '.' . "\n\n" . 'IMPORTANT: Remember, this is just a notification. Please do not reply to this email.';
$txt['pm_multiple'] = '(multiple recipients: \'name1, name2\')';



Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 28
    • studio five
It also goes on to say this:
guess you'd have to change
Code: [Select]
$mailmessage = str_replace(array('SUBJECT', 'MESSAGE', 'SENDER'), array($subject, $message, un_htmlspecialchars($from['name'])), $txt['pm_email']);to
Code: [Select]
$mailmessage = str_replace(array('SUBJECT', 'SENDER'), array($subject, un_htmlspecialchars($from['name'])), $txt['pm_email']);
in Subs-Post.php, correct?
and this:
So you need to splice in new language strings that don’t have that problem, and conveniently leave out the MESSAGE part to not be replaced in while you’re at it.
Is all of this required?

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,969
you only need to do what I quoted.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,196
    • StoryBB/StoryBB on GitHub
Because the part you quoted sums up what I suggested, and the other stuff isn’t needed :)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 28
    • studio five
There's my confusion Illori.
You and Arantor appear to be saying different things are needed.
Which of the quoted bits of code do i use?
Or do I use both?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,196
    • StoryBB/StoryBB on GitHub
Go with what Illori says because it's how to do what I said.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 28
    • studio five
That worked. Thanks!  :)

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 28
    • studio five
I spoke too soon.
Now I get a link in the notification that says this:
https://website/index.php?action=pm;sa=send;f=inbox;pmsg=40;quote;u=14
Obviously the wrong place to send someone.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,133
Did you change anything other than PersonalMessage.english.php?

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 28
    • studio five
No. I simply copied and pasted the code which Illori posted in PersonalMessage.english.php.
However, looking back at some earlier PM notices, which contained the message, the link is the same. It also goes to the New Message page with the editor pane and the PM from the other member is wrapped in quote tags.
In my view the link should be to the PM from the sender.
Should I start a new Topic?

Offline a10

  • Charter Member
  • Sr. Member
  • *
  • Posts: 855
Was a pain many years ago, after evaluating what to do, chose to keep the text in the notif email, while adding a much clearer 'do not reply' warning. Did cut down the problem by 99% :O)

PersonalMessage.english.php

Code: [Select]
$txt['pm_email'] = 'You have just been sent a Personal Message by SENDER on ' . $context['forum_name'] . '.' . "\n\n" . '***** DO NOT REPLY TO THIS EMAIL ***** - THIS IS ONLY A NOTIFICATION ABOUT A NEW PM -' . "\n\n" . 'The message they sent you was:' . "\n\n" . 'MESSAGE';
$txt['pm_multiple'] = '(multiple recipients: \'name1, name2\')';
// Use numeric entities in the below string.
$txt['instant_reply'] = 'REPLY TO THE PERSONAL MESSAGE HERE:';
2.0.15, ssl, php 7.1.31, MySQL 10.3.13-MariaDB~bionic
Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,133
Unless you changed something else, the link in the email should take you to reply editor with pm quoted.

Offline RGMears

  • Semi-Newbie
  • *
  • Posts: 28
    • studio five
That is what is happening.
My question is how to make it simply go to the message. The same as in most email clients.

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,969
depending on what view of PM's are set as the link is different. I think the way it is set is the best way to get the user directly to the message that was sent.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,133
If you want to link to the message -

Subs-Post.php

Find this -

Code: [Select]

$mailmessage .= "\n\n" . $txt['instant_reply'] . ' ' . $scripturl . '?action=pm;sa=send;f=inbox;pmsg=' . $id_pm . ';quote;u=' . $from['id'];


Change to this -

Code: [Select]

$mailmessage .= "\n\n" . $txt['instant_reply'] . ' ' . $scripturl . '?action=pm#msg' . $id_pm;


Shouldn't affect anything else.