Vova Zk Posted June 13, 2017 Share Posted June 13, 2017 Hi, I’m trying to make email subject lines include topic titles when a new mention is made, but they just fail to work (no email is sent at all). The way I did it is was by inserting this line in "Languages" instead of the default one for mailsub__core_notification_mention: Quote Re: {$comment->item()->mapped("title")|raw} Moreover, when I try to replace the default one for mailsub__core_notification_new_comment (which is precisely “{$comment->item()->mapped("title")|raw}”) to “Re: {$comment->item()->mapped("title")|raw}” (with just the addition of "Re: "), it stops working, too (no emails sent). What am I doing wrong? Link to comment Share on other sites More sharing options...
Vova Zk Posted June 15, 2017 Author Share Posted June 15, 2017 Anyone? Link to comment Share on other sites More sharing options...
Vova Zk Posted June 19, 2017 Author Share Posted June 19, 2017 @Daniel F, @Morgin, @opentype — maybe you guys have some tips?.. Link to comment Share on other sites More sharing options...
bfarber Posted June 19, 2017 Share Posted June 19, 2017 First and foremost, do NOT use the |raw modifier here. A content item title (such as a topic title) is user-generated/submitted content, and a malicious user could submit a topic title that contains XSS in it. You do not want to embed raw javascript or other potentially malicious content directly into an email using |raw. Secondly, I cannot see any reason or duplicate any problems adding "Re:" to the new_comment email template. For the mention template, the mention could be for a topic or for a comment, so you need to do it like so: Re: {{if $content instanceof \IPS\Content\Comment}}{$content->item()->mapped('title')}{{else}}{$content->mapped('title')}{{endif}} Link to comment Share on other sites More sharing options...
Vova Zk Posted June 21, 2017 Author Share Posted June 21, 2017 @bfarberThank you so much, Brandon! I’ll try that out and let you know if it worked! As for the "raw" snippet, I believe I took it from an existing mailing template. Maybe I misunderstood something, though! Upd. It worked like magic, thanks once again! And no, I didn't take it from an email template (I wonder where did I take it from, then... — but that's a question for another day ). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.