How to remove Message text in Email notifications for Private Messages?

Started by RGMears, May 16, 2019, 06:44:30 AM

Previous topic - Next topic

RGMears

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.

Kindred

Please start your own topic,  especially since your question is different from the original thread.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."


a10

2.0.19, php 8.0.23, MariaDB 10.5.15. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

RGMears

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.

Illori

the below message from that topic has the steps you need to follow. what you want done, cannot be completed without a code edit.

Quote from: Sir Osis of Liver on June 27, 2018, 11:27:32 PM
PersonalMessage.english.php

Find this -



// 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 -



// 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\')';




RGMears

It also goes on to say this:
Quote from: SychO on July 20, 2018, 06:51:26 AM
guess you'd have to change
$mailmessage = str_replace(array('SUBJECT', 'MESSAGE', 'SENDER'), array($subject, $message, un_htmlspecialchars($from['name'])), $txt['pm_email']);
to$mailmessage = str_replace(array('SUBJECT', 'SENDER'), array($subject, un_htmlspecialchars($from['name'])), $txt['pm_email']);

in Subs-Post.php, correct?
and this:
Quote from: Arantor on July 20, 2018, 06:55:30 AM
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?

Illori


Arantor

Because the part you quoted sums up what I suggested, and the other stuff isn't needed :)

RGMears

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?

Arantor

Go with what Illori says because it's how to do what I said.


RGMears

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.

Sir Osis of Liver

Did you change anything other than PersonalMessage.english.php?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

RGMears

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?

a10

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

$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.19, php 8.0.23, MariaDB 10.5.15. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

Sir Osis of Liver

Unless you changed something else, the link in the email should take you to reply editor with pm quoted.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

RGMears

That is what is happening.
My question is how to make it simply go to the message. The same as in most email clients.

Illori

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.

Sir Osis of Liver

If you want to link to the message -

Subs-Post.php

Find this -



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



Change to this -



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



Shouldn't affect anything else.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Advertisement: