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
if(isSendEmail)
{
sendEmail(value, EmailId);
return View();
if(sendEmail(value, EmailId))
{
return Json(new { status = "Success" });
}
else
{
return Json(new { status = "Failed" });
}
}
else
{
......@@ -174,7 +182,7 @@ namespace Mobile.Search.Web.Controllers
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 to = new MailAddress(email_id);
......@@ -187,13 +195,17 @@ namespace Mobile.Search.Web.Controllers
try
{
client.Send(message);
return true;
}
catch (Exception ex)
{
Console.WriteLine("Exception caught in CreateTestMessage4(): {0}",
ex.ToString());
return false;
}
return true;
}
......
......@@ -125,6 +125,11 @@
<strong>Email to : <u><strong id="email_id"></strong></u> Send Successfully</strong>
</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>-->
</div>
......@@ -224,6 +229,7 @@
//});
$(document).ready(function () {
$('#sent_to_email').hide();
$('#sent_to_email_failed').hide();
$.get("/Template/S3Signature", {})
.done(function (data) {
$('#FroalaHtmlEditor').froalaEditor({
......@@ -257,12 +263,20 @@
dataType: "json",
traditional: true,
contentType: "application/json; charset=utf-8",
complete: function () {
$('#email_id').empty().append(EmailId);
$('#sent_to_email').show();
document.getElementById("EmailId").value = ""
}
success: function (data) {
if (data.status == "Success") {
$('#sent_to_email_failed').hide();
$('#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