Commit 3ef0adb7 by Urvil Shah

Regex to Add the Wrap Url

parent f6754003
Pipeline #7261 passed with stages
in 14 seconds
......@@ -16,6 +16,7 @@ using System.IO;
using System.Collections;
using Newtonsoft.Json;
using System.Net.Mail;
using System.Text.RegularExpressions;
namespace Mobile.Search.Web.Controllers
{
......@@ -121,7 +122,7 @@ namespace Mobile.Search.Web.Controllers
};
_dynamoClient.WriteSingle("prd_2click_templates", d);
return RedirectToAction("Index");
return RedirectToAction("FroalaIndex");
}
catch (Exception x)
{
......@@ -147,14 +148,29 @@ namespace Mobile.Search.Web.Controllers
try
{
string url = "http://config.minbox.email/Offer/Create/template_attribute=";
Match m;
string HRefPattern = "href\\s*=\\s*(?:[\"'](?<1>[^\"']*)[\"']|(?<1>\\S+))";
// _dynamoClient.WriteSingle("prd_2click_templates", d);
m = Regex.Match(value, HRefPattern,
RegexOptions.IgnoreCase | RegexOptions.Compiled,
TimeSpan.FromSeconds(1));
while (m.Success)
{
string to_replace = String.Format("{{{{WrapUrl('{0}')}}}}", m.Groups[1]);
value=value.Replace(m.Groups[1].Value, to_replace);
m = m.NextMatch();
}
var d = new Dictionary<string, object>
{
{"templateKey", key.ToLower()},
{"html", value}
};
// _dynamoClient.WriteSingle("prd_2click_templates", d);
Console.WriteLine(value);
if(isSendEmail)
if (isSendEmail)
{
if(sendEmail(value, EmailId))
{
......@@ -219,11 +235,7 @@ namespace Mobile.Search.Web.Controllers
return true;
}
catch (SmtpFailedRecipientException ex)
{
// ex.FailedRecipient and ex.GetBaseException() should give you enough info.
return false;
}
catch (Exception ex)
{
Console.WriteLine("Exception caught in CreateTestMessage4(): {0}",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment