1const SMTP={configData:{},initSMTPSetup:function(){$("#smtp_setup_form").on("submit",function(e){e.preventDefault();const data=serializeFormObject($(this));SMTP.isAnyError(data)||(data.enable_smtp=$("input[name=enable_smtp]").prop("checked")?1:0,SMTP.configData=data,SMTP.showTestEmailPopup())}),$(document).on("change","input[name=enable_smtp]",function(e){let value=e.target.checked?1:0;$.post("//"+__api_domain+"/user/services/api",{cmd:"updateSMTPCheck",enable:value},function(response){parseInt(extractDataFromArray(response,["errorCode"],0))>0?SwalPopup.showSingleButtonPopup({icon:"error",text:extractDataFromArray(response,["errorMsg"],"Error occured. Please try again!")}):SwalPopup.showSingleButtonPopup({icon:"success",text:value==1?"Enabled Successfully.":"Disabled Successfully."})})}),$(document).on("click",".edit_smtp",function(e){e.preventDefault(),$("#smtp_setup_form").find("input, select").prop("disabled",!1),$("#smtp_setup_form .validate_btn").removeClass("d-none"),$(this).parents(".edit_action").addClass("d-none"),$(".configure_btn").addClass("d-none")})},isAnyError:function(data={}){let parent=$("#smtp_setup_form");parent.find(".error").text("");for(let field of Object.keys(data)){if(field=="cmd")continue;let errorTag=parent.find(`[name="${field}"]`).parents(".input_main").find(".error");if(isEmpty(data[field])&&field!="bounce_email")return errorTag.text("This is required."),!0;if((field=="email"||field=="bounce_email"&&!isEmpty(data[field]))&&!isValidEmailAddress(data[field]))return errorTag.text("Enter a valid email address."),!0}return!1},showTestEmailPopup:function(){Swal.fire({title:"Test SMTP Configuration",html:`<div class="text-left"> 2 <div class="mb-2" style="color:var(--secondary-color-1)">Enter an email address to receive a test email using the configured SMTP settings.</div> 3 <input class="form-control" type="email" name="test_email" placeholder="Enter email address"> 4 </div>`,confirmButtonText:"Send Test Email",showCancelButton:!0,reverseButtons:!0,preConfirm:()=>{const email=$("input[name=test_email]").val();if(isEmpty(email)){Swal.showValidationMessage("Please enter an email address");return}if(!isValidEmailAddress(email)){Swal.showValidationMessage("Please enter a valid email address");return}return{test_email:email}}}).then(result=>{if(result.isConfirmed){SMTP.configData.test_email=extractDataFromArray(result,["value","test_email"],"");let data=SMTP.configData;$.post("//"+__api_domain+"/user/services/api",data,function(response){parseInt(extractDataFromArray(response,["errorCode"],0))>0?SwalPopup.showSingleButtonPopup({icon:"error",text:extractDataFromArray(response,["errorMsg"],"Error occured. Please try again!")}):SwalPopup.showSingleButtonPopup({icon:"success",text:extractDataFromArray(response,["errorMsg"],"Error occured. Please try again!")},()=>{location.reload()})})}})}};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.