Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chris Van Oort 110 posts 370 karma points
    Jan 24, 2017 @ 22:46
    Chris Van Oort
    0

    "s.gif" appearing on all emails sent?

    Does anyone know why this code appears on all of the emails sent? It's appearing as a broken image in Outlook -- which is a problem for us. I'm assuming it's potentially something related to tracking or statistics.

    Looks like this: enter image description here

    <IMG style="opacity: 0" src="http://{redacted-domain-name}/App_Plugins/PerplexMail/s.gif?i=4&amp;a=view">
    

    I need to either make it invisible or remove it so it doesn't appear as a broken image on emails.

    Running:

    • Umbraco 7.5.7
    • Umbraco Forms 4.4.0
    • PerplexMail 2016-11-02

    Any help is appreciated! Thank you

    Edit

    It does appear this is related to statistics per the documentation. I'm not sure how to get it to appear as anything other than a broken image in emails.

  • Chris Van Oort 110 posts 370 karma points
    Jan 25, 2017 @ 21:25
    Chris Van Oort
    0

    A bit more testing into this... The image loads fine straight away without any query strings. However, the mailer code is inserting these with query strings for tracking purposes. If I wasn't getting a server error I wouldn't end up with what appears as a broken image and it'd be transparent to end users -- pretty slick.

    The error appears to be a conflict with Umbraco trying to handle images with query strings via ImageProcessor.

    enter image description here

    If I determine a fix, I'll post back.

    Edit: The fix is to append "ipignore=true" to the query string of the url as so:

    http://{your domain name goes here}.com/App_Plugins/PerplexMail/s.gif?i=14&a=view&ipignore=true
    

    I'll probably run a custom build of the dll for the moment, but I'll try and submit a pull request to fix the issue.

    Edit2: Not sure how this should best be added to the image. I'm going to skip the pull request; I'm assuming this is also fixable with a IIS Rewrite rule. I did dig into the ImageProcessor library and they don't have an "exclude" or "ignore" setting anywhere that I can see.

  • Chris Van Oort 110 posts 370 karma points
    Jan 26, 2017 @ 17:13
    Chris Van Oort
    0

    Couldn't get this to work with IIS rewrite rules, but I created a pull request for this.

    https://github.com/PerplexInternetmarketing/PerplexMail-for-Umbraco/pull/2

  • [email protected] 406 posts 2135 karma points MVP 7x c-trib
    Jan 31, 2017 @ 09:38
    jeffrey@umarketingsuite.com
    100

    Hi guys,

    sorry for the late reply but the image is added because of tracking purposes. It's a single pixel that when it's get loaded update the statistics tab that somebody has opened this e-mail.

    We forgot to add this to the documentation (will do soon hopefully), but one way of getting rid of the error is by cancelling this request to go through ImageProcessor. This can be done to add this to the Global.asax.cs

        private void ImageProcessingModule_ValidatingRequest(object sender, ImageProcessor.Web.Helpers.ValidatingRequestEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(e.QueryString))
            {
                // When we encounter the s.gif, skip the image processing module to prevent the error
                if (e?.Context?.Request?.FilePath == "/App_Plugins/PerplexMail/s.gif")
                {
                    e.Cancel = true;
                    return;
                }
            }
        }
    

    And this

    protected override void OnApplicationStarting(object sender, EventArgs e)
        {
            ImageProcessingModule.ValidatingRequest += ImageProcessingModule_ValidatingRequest;
        }
    

    This will prevent ImageProcessor kicking in.

    Hope this helps,

    Jeffrey

  • Chris Van Oort 110 posts 370 karma points
    Mar 03, 2017 @ 19:26
    Chris Van Oort
    0

    Hi Jeffery,

    Finally getting back to this now that I have time. In my project, all I have is "Global.asax" without the associated "Global.asax.cs" class.

    It's contains:

    <%@ Application Inherits="Umbraco.Web.UmbracoApplication" Language="C#" %>
    

    Any idea how I get that .cs class added in and what I need to change the existing Global.asax code to be to link up?

    Thanks, Chris

  • Matthew Kirschner 323 posts 611 karma points
    Jul 07, 2017 @ 19:14
    Matthew Kirschner
    0

    Hi, Chris.

    In modern Umbraco apps, you need to create a class that inherits from ApplicationEventHandler.

    For example, I made a class called RegisterEvents and put it in an 'Events' folder in the root of my project. In this class, you can override the ApplicationStarting event that Jeffrey mentions in his post. It will look something like this:

    public class RegisterEvents : ApplicationEventHandler
    {
        protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            ImageProcessingModule.ValidatingRequest += ImageProcessingModule_ValidatingRequest;
    
            base.ApplicationStarting(umbracoApplication, applicationContext);
        }
    
        private void ImageProcessingModule_ValidatingRequest(object sender, ImageProcessor.Web.Helpers.ValidatingRequestEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(e.QueryString)) return;
    
            // When we encounter the s.gif, skip the image processing module to prevent the error
            if (e?.Context?.Request?.FilePath == "/App_Plugins/PerplexMail/s.gif")
            {
                e.Cancel = true;
            }
        }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft