kumar reddy

kumar reddy

  • NA
  • 11
  • 402

clicking on "sendtestmail" it is not sending

Sep 20 2018 2:19 AM
<div class="form-group">
<label asp-for="SendTestEmailTo" class="col-md-3 control-label"></label>
<div class="col-md-6">
<input type="text" asp-for="SendTestEmailTo" class="form-control" placeholder="Send Test Email To" />
<span id="validation" asp-for="SendTestEmailTo" class="text-danger"></span><br />
<br />
<input name="submit" type="submit" id="sendtestemail" onclick="javascript:SendTestMail();" class="btn btn-inverse" value="submit" />
</div>
</div>
</form>
<script type="text/javascript">
$(document).ready(function SendTestMail () {
$("#sendtestemail").click(function () {
var SendTestMail = $("#SendTestEmailTo").val();
var status = false;
if (SendTestMail == "") {
$("#validation").text("This field cannot be empty.....");
$("#validation").show();
}
else if (SendTestMail != '') {
var regex = /[A-Z0-9._%+-]+@@[A-Z0-9.-]+.[A-Z]{2,4}/igm;
status = regex.test(SendTestMail);
if (!status) {
$("#validation").text("Please enter valid email address");
$("#validation").show();
}
}
if (status) {
$("#validation").hide();
$.ajax({
type: "POST",
url: '/EmailAccount/SendTestEmail',
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
dataType: "json",
});
}
});
});
</script>

Answers (1)