Is it possible to change the url in the email notifications?

Technical Support
  • I'm running nodebb and another node app on the same server, using a reverse proxy. Due to that, the image links in the posts are relative, and don't display correctly in email notifications.

    Is there any way of running some kind of a script on the {{content}} that will replace all instances of relative links to direct links in the notification email?

    PS. Where all of the template files for notifications are located? They dont seem to be in \src\views\emails\ - I can't find for example the new topic notification there.

  • @Lucas-Severyn I believe emails use "url" property in config.json? check that.

  • Yes, they use {url} for the static stuff, but for the post content they use the actual post content.

    I'd like to adjust the urls in post content (but only in the emails) - I already changed the urls for other elements like link to the user, link to the topic, by hardcoding the leading part.

  • @Lucas-Severyn can you give an example? You shouldn't have to adjust the URLs in the post content. It's supposed to automatically rewrite relative URLs to absolute ones.

  • Sure, for example this is the source code of the email that doesn't display the images:

    in all cases where I have a working link, I actually overrode them in the template

    Here is the email source - notice the indirect image sources:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">.emoji[data-set-id="emoji-one"]{vertical-align:middle;height:20px;width:20px}</style>
    
    
    <p>
    	<a href="http://dash/board/user/Lucas"><img style="vertical-align: middle; width: 24px; height: 24px; padding-right: 1em;" src="" title="Lucas"></a>
    	<a href="http://dash/board/user/Lucas">Lucas</a> has posted a new topic called &quot;<a href="http://dash/board/topic/15/updated-latest-news">Updated latest news</a>&quot; in &quot;<a href="http://dash/board/category/2/dcl">DCL</a>&quot;:
    </p>
    
    <blockquote><p>
    •	We probably need .....<br>
    •	No change.... <br>
    •	I assume ....</p>
    <p><img src="/nodebb/uploads/files/1478707630983-upload-606926c6-a083-4817-81c5-bf6732159c6d.png" alt="0_1478707659844_upload-606926c6-a083-4817-81c5-bf6732159c6d" class="img-responsive img-markdown"></p>
    <p><img src="/nodebb/uploads/files/1478707646862-upload-26466cf8-c236-4440-acc7-e80b98f8da05-resized.png" alt="0_1478707675336_upload-26466cf8-c236-4440-acc7-e80b98f8da05" class="img-responsive img-markdown"></p>
    </blockquote>
    
    <a href="http://dash/board/topic/15/updated-latest-news">Click here to view the topic</a>
    

    and here is the template I edited myself - notice the manual overrides to at least make some of the links work:

    <p>
    	<a href="http://dash/board/user/{user.slug}"><img style="vertical-align: middle; width: 24px; height: 24px; padding-right: 1em;" src="{user.picture}" title="{user.name}" /></a>
    	<a href="http://dash/board/user/{user.slug}">{user.name}</a> has posted a new topic called "<a href="http://dash/board/topic/{topicSlug}">{title}</a>" in "<a href="http://dash/board/category/{category.slug}">{category.name}</a>":
    </p>
    
    <blockquote>{content}</blockquote>
    
    <a href="http://dash/board/topic/{topicSlug}">Click here to view the topic</a>
    
  • For the sake of completeness, here is how I solved it.

    I'm not very proud of the solution but it works.

    In the emailer plugin, I added this bit to mailOptions variable.
    Now I need to be very careful not to update the plugin and overwrite the index.js file

     var mailOptions = {
        from: data.from,
        to: data.to,
        html: data.html.replaceAll ('src="/nodebb/','src="http://dash/nodebb/'),
        text: data.plaintext,
        // subject: data.subject
        subject: combinedTopic
    };
    

Suggested Topics


  • 0 Votes
    6 Posts
    453 Views

    @PitaJ said in email notifications for post queue:

    Just so everyone knows, there's a search bar in the ACP, that searches the ACP. If you're looking for a setting that may be a good place to start.

    Oh, I've never seen that. It's in all that "Dead space" way up top that I scroll past before it even loads because there is so much wasted space. Good to know that that is there.

    Would be nice to see that area compressed a bit, so much empty space up there.

  • 0 Votes
    8 Posts
    422 Views

    It worked šŸ™‚

    I have now a user icon there instead of avatar šŸ™‚

    45d0aa70-b9e4-4ed7-89c8-a35773cf89e6-image.png

  • Changing names votes?

    Technical Support
    2
    0 Votes
    2 Posts
    1k Views

    After digging into this is appears that there's actually no language strings for like and dislike, however there's a alternative to the default reputation system, and that is @Nicolas his likes plugin. This will work with the latest version of NodeBB.

  • change the nodebb port

    Technical Support
    3
    0 Votes
    3 Posts
    2k Views

    @pichalite Got it thank you.

  • 0 Votes
    7 Posts
    3k Views

    @baris ,

    Social sso plugin problem solved I can now select ssl option
    Ā 

    Still get

    [plugins/load] The following plugins may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing. In the event of an unresponsive NodeBB caused by this plugin, run ./nodebb reset -p PLUGINNAME to disable it.

    nodebb-plugin-emailer-local

    And Emailer not installed , any suggestions?