Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Urvil Shah
/
MobEasyEditor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3ef0adb7
authored
Apr 03, 2018
by
Urvil Shah
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Regex to Add the Wrap Url
parent
f6754003
Pipeline
#7261
passed with stages
in 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
Mobile.Search.Web/Controllers/TemplateController.cs
Mobile.Search.Web/Controllers/TemplateController.cs
View file @
3ef0adb7
...
...
@@ -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
(
"
Froala
Index"
);
}
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}"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment