Commit 9c697ddc by Urvil Shah

Show the status of the Email Receiving and sending.

parent 99044bfb
Pipeline #7199 passed with stages
in 22 minutes 38 seconds
...@@ -151,8 +151,16 @@ namespace Mobile.Search.Web.Controllers ...@@ -151,8 +151,16 @@ namespace Mobile.Search.Web.Controllers
if(isSendEmail) if(isSendEmail)
{ {
sendEmail(value, EmailId); if(sendEmail(value, EmailId))
return View(); {
return Json(new { status = "Success" });
}
else
{
return Json(new { status = "Failed" });
}
} }
else else
{ {
...@@ -174,7 +182,7 @@ namespace Mobile.Search.Web.Controllers ...@@ -174,7 +182,7 @@ namespace Mobile.Search.Web.Controllers
return View(); return View();
} }
public void sendEmail(string value,string email_id) public bool sendEmail(string value,string email_id)
{ {
MailAddress from = new MailAddress(FromEmail, "TemplateTest"); MailAddress from = new MailAddress(FromEmail, "TemplateTest");
MailAddress to = new MailAddress(email_id); MailAddress to = new MailAddress(email_id);
...@@ -187,13 +195,17 @@ namespace Mobile.Search.Web.Controllers ...@@ -187,13 +195,17 @@ namespace Mobile.Search.Web.Controllers
try try
{ {
client.Send(message); client.Send(message);
return true;
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("Exception caught in CreateTestMessage4(): {0}", Console.WriteLine("Exception caught in CreateTestMessage4(): {0}",
ex.ToString()); ex.ToString());
return false;
} }
return true;
} }
......
...@@ -125,6 +125,11 @@ ...@@ -125,6 +125,11 @@
<strong>Email to : <u><strong id="email_id"></strong></u> Send Successfully</strong> <strong>Email to : <u><strong id="email_id"></strong></u> Send Successfully</strong>
</div> </div>
</div> </div>
<div id="sent_to_email_failed">
<div class="alert alert-success" role="alert">
<strong>Email to : <u><strong id="email_id_failed"></strong></u> Send Failed</strong>
</div>
</div>
<!-- <iframe width="375" height="650" src="/search/template?templateKey=@Model.Key&keyword=audi+a4&debug=true" style="border: solid 1px black; margin: auto"></iframe>--> <!-- <iframe width="375" height="650" src="/search/template?templateKey=@Model.Key&keyword=audi+a4&debug=true" style="border: solid 1px black; margin: auto"></iframe>-->
</div> </div>
...@@ -224,6 +229,7 @@ ...@@ -224,6 +229,7 @@
//}); //});
$(document).ready(function () { $(document).ready(function () {
$('#sent_to_email').hide(); $('#sent_to_email').hide();
$('#sent_to_email_failed').hide();
$.get("/Template/S3Signature", {}) $.get("/Template/S3Signature", {})
.done(function (data) { .done(function (data) {
$('#FroalaHtmlEditor').froalaEditor({ $('#FroalaHtmlEditor').froalaEditor({
...@@ -257,12 +263,20 @@ ...@@ -257,12 +263,20 @@
dataType: "json", dataType: "json",
traditional: true, traditional: true,
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
complete: function () { success: function (data) {
$('#email_id').empty().append(EmailId); if (data.status == "Success") {
$('#sent_to_email').show(); $('#sent_to_email_failed').hide();
document.getElementById("EmailId").value = "" $('#email_id').empty().append(EmailId);
$('#sent_to_email').show();
} document.getElementById("EmailId").value = ""
} else {
$('#sent_to_email').hide();
$('#email_id_failed').empty().append(EmailId);
$('#sent_to_email_failed').show();
document.getElementById("EmailId").value = ""
}
}
}); });
......
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