4

This error is showing up in my Sitecore error logs 5,611 times a day. Any thoughts on how to fix it?

Sitecore 7.5

464 2017:01:05 00:00:00 ERROR Cannot process 'ProcessSubscriptions' processor because of internal error
Exception: System.ArgumentException
Message: The parameter 'address' cannot be an empty string.
Parameter name: address
Source: System
   at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding)
   at Sitecore.Analytics.Pipelines.CommitSession.ProcessSubscriptions.Process(CommitSessionPipelineArgs args)
2

This error appears because you have not filled the below setting:

   <setting name="Analytics.EMailFromAddress" value="" />

in Sitecore.Analytics.config.

Also, check if in the web.config file the "MailServer" setting is filled in with an address of your SMTP server as well as the "MailServerUserName", "MailServerPassword" and "MailServerPort".

In the ProcessSubscriptions processor you have next code that use Analytics.EMailFromAddress setting :

  public class ProcessSubscriptions : CommitSessionProcessor
  {
    public override void Process(CommitSessionPipelineArgs args)
    {
        try
        {
            Assert.IsNotNull(args.Session, "Tracker.Current.Session is not initialized");
            ISmtpClient smtpClient = (Factory.CreateObject("emailprovider", false) as ISmtpClient) ?? new SmtpClientWrapper();
            Session session = args.Session;
            CurrentInteraction interaction = session.Interaction;
            Assert.IsNotNull(interaction, "visit");
            interaction.UpdateLocationReference();
            if (!interaction.LocationId.HasValue)
            {
                Log.Debug("[Analytics]: The CommitSession pipeline, ProcessSubscriptions - Location id IS NUll, the processing is terminated", this);
            }
            else
            {
                LocationData locationData = Tracker.Dictionaries.Locations.Get(interaction.LocationId.Value, LookupStrategy.Default);
                if (locationData == null || !locationData.Subscriptions.Any<string>())
                {
                    Log.Debug("[Analytics]: The CommitSession pipeline, ProcessSubscriptions is skipped - there is no subscriptions for location id: " + interaction.LocationId.Value, this);
                }
                else
                {
                    HtmlTextWriter htmlTextWriter = new HtmlTextWriter(new System.IO.StringWriter());
                    htmlTextWriter.Write("<html>");
                    htmlTextWriter.Write("<head></head>");
                    htmlTextWriter.Write("<body>");
                    ProcessSubscriptions.RenderSummary(htmlTextWriter, session);
                    ProcessSubscriptions.RenderSessionTrail(htmlTextWriter, interaction);
                    ProcessSubscriptions.RenderSessionLink(htmlTextWriter, interaction);
                    ProcessSubscriptions.RenderUnsubscribeLink(htmlTextWriter, interaction);
                    htmlTextWriter.Write("</body>");
                    htmlTextWriter.Write("</html>");
                    MailAddress from = new MailAddress(AnalyticsSettings.EmailFromAddress);
                    MailMessage mailMessage = new MailMessage
                    {
                        From = from,
                        Subject = string.Concat(new object[]
                        {
                            "[Sitecore Analytics] ",
                            interaction.GeoData.BusinessName,
                            " visited the site at ",
                            DateUtil.ToServerTime(interaction.StartDateTime),
                            "."
                        }),
                        Body = htmlTextWriter.InnerWriter.ToString(),
                        BodyEncoding = System.Text.Encoding.UTF8,
                        IsBodyHtml = true
                    };
                    foreach (string current in locationData.Subscriptions)
                    {
                        mailMessage.Bcc.Add(current);
                    }
                    try
                    {
                        smtpClient.Send(mailMessage);
                    }
                    catch (System.Exception exception)
                    {
                        Log.Error("Failed to send subscription notification", exception, typeof(ProcessSubscriptions));
                    }
                    Log.Info("SubscriptionTask done.", this);
                }
            }
        }
        catch (System.Exception exception2)
        {
            Log.Error("Cannot process 'ProcessSubscriptions' processor because of internal error", exception2, this);
        }
    }
  • I will try this and let you know. It will be a week or more before I can get this change to our production web site. – ADH Jan 6 '17 at 12:48
  • This worked. All those errors have stopped. – ADH Jan 20 '17 at 15:09
  • Great! Happy to help you :) – Vlad Iobagiu Jan 20 '17 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.