+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Newsletter Sending Stalls

Newsletter Sending Stalls

2 posts, 0 answered
  1. Mika Moser
    Mika Moser avatar
    4 posts
    Registered:
    26 Jan 2010
    13 Jan 2010
    Link to this post
    I have another newsletter issue.  We have a list of about 2100 names, when this lists gets send out, it stalls at about 3% complete and never completes. 

    I found one invalid name (used the extension .xxx instead of .com or anything valid), but that shouldn't make the full sending stall, should it???

    Help!
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    14 Jan 2010
    Link to this post
    Hello Chris,

    Thank you for using our services.

    Unfortunately invalid e-mails will break the Newsletter sending. Please inspect the newsletter subscribers and verify if their e-mails are valid. Of course you do not have to do this by hand. You can iterate through all subscribers with following sample code snippet:
    Telerik.Notifications.Newsletters.DataManager newslettersManager = new Telerik.Notifications.Newsletters.DataManager();
    foreach (Telerik.Newsletters.ISubscriber subscriber in newslettersManager.GetSubscribers())
    {
        string email = subscriber.Email;
    }

    Then once you get subscribers emails you can check with a regular expressions if e-mail is valid if not you can remove the invalid subscriber for example:
    string strRegex = @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
                     @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
                     @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
    System.Text.RegularExpressions.Regex re = new Regex(strRegex);
    if (!re.Match(email, ""))
    {
         //output faulty email.
         //or remove it from subscribers group using
         newslettersManager.DeleteSubscriber(subscriber.SubscriberId);
    };

    You can also make sure that that subscribers enter valid e-mails using a regular expressions validator. You should also validate that all subscriber names do not contain special characters and consist only of English alpha-numneric characters. To do this go to ~/Sitefinity/ControlTemplates/Newsletters/SubscriptionFormTemplate.ascx. If you are using e-mail only mode for the subscription form you should add reg ex validator only to textbox with ID sf1_email. If mode with e-mails and names is used add validators to text controls that are in emailNamehldr placeholder here is a sample for reg ex validators:
    Copy Code
    <li>
        <asp:Label ID="Label1" runat="server" Text="Email:" AssociatedControlID="sf2_email"></asp:Label>
        <asp:TextBox runat="server" ID="sf2_email" CssClass="sf_subscribeTxt" ValidationGroup="subscription"></asp:TextBox>
        <asp:RequiredFieldValidator ID="emailEmptyValidator2" runat="server" CssClass="sf_emailValidation"
            ValidationGroup="subscription" ControlToValidate="sf2_email" Display="Dynamic"
            EnableViewState="False" SetFocusOnError="True">
            <strong><asp:Literal ID="Literal7" runat="server" Text="Email cannot be empty!"></asp:Literal></strong>
        </asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator ID="emailREValidator2" runat="server" CssClass="sf_emailValidation"
            ControlToValidate="sf2_email" Display="Dynamic" EnableViewState="false" SetFocusOnError="true"
            ValidationExpression="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" ValidationGroup="subscription">
            <strong><asp:Literal ID="literal22" runat="server" Text="Wrong email!"></asp:Literal></strong>
        </asp:RegularExpressionValidator>
    </li>
    <li>
        <asp:Label ID="Label2" runat="server" AssociatedControlID="sf_firstname" Text="First name:"></asp:Label>
        <asp:TextBox runat="server" CssClass="sf_subscribeTxt" ID="sf_firstname"></asp:TextBox>
         <asp:RegularExpressionValidator ID="firstNameValidator" runat="server" CssClass="sf_emailValidation"
            ControlToValidate="sf_firstname" Display="Dynamic" EnableViewState="false" SetFocusOnError="true"
            ValidationExpression="^[a-zA-Z0-9]*$" ValidationGroup="subscription">
            <strong><asp:Literal ID="literal3" runat="server" Text="First name can contain only Elnglish alphanumeric characters"></asp:Literal></strong>
        </asp:RegularExpressionValidator>
    </li>

    Since you have a large number of subscribers you can also increase the e-mail sending interval so you do not flood your SMTP server. This can be done through web.config:
    <notifications defaultProvider="Notifications"
          <providers
            <clear/> 
            <add name="Notifications"  
             type="Telerik.Notifications.Data.DefaultProvider, Telerik.Notifications.Data"  
             connectionStringName="DefaultConnection"  
             EnableSsl="false"  
             MergedFields="FirstName;LastName"  
             SendingInterval="1000"/> 
          </providers>


     Best wishes,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered