sendtestmail.js
1012 Bytes
var sendTestMail=function(){$=jQuery;var e={smtpauth:$('input[name="jform[smtpauth]"]:checked').val(),smtpuser:$('input[name="jform[smtpuser]"]').val(),smtppass:$('input[name="jform[smtppass]"]').val(),smtphost:$('input[name="jform[smtphost]"]').val(),smtpsecure:$('select[name="jform[smtpsecure]"]').val(),smtpport:$('input[name="jform[smtpport]"]').val(),mailfrom:$('input[name="jform[mailfrom]"]').val(),fromname:$('input[name="jform[fromname]"]').val(),mailer:$('select[name="jform[mailer]"]').val(),mailonline:$('input[name="jform[mailonline]"]:checked').val()};Joomla.removeMessages(),$.ajax({method:"POST",url:document.getElementById("sendtestmail").getAttribute("data-ajaxuri"),data:e,dataType:"json"}).fail(function(e,a,m){Joomla.renderMessages(Joomla.ajaxErrorsMessages(e,a,m)),window.scrollTo(0,0)}).done(function(e){"object"==typeof e.messages&&null!==e.messages&&(Joomla.renderMessages(e.messages),window.scrollTo(0,0))})};jQuery(document).ready(function(e){e("#sendtestmail").click(sendTestMail)});