- md5
- cbec6ea2d7a7e83bc90fd81b7fa6cac9
- sha1
- db27ff7aa2ce89b23911e58171d956faae78b81c
- sha256
- 050f1c010ee6a7b0c08983c40d2aef4fe09042b2df44ec52a23dce4289f08584
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
"use strict";
;
((customElements, Joomla) => {
class JoomlaFieldSendTestMail extends HTMLElement {
// attributeChangedCallback(attr, oldValue, newValue) {}
constructor() {
super();
if (!Joomla) {
throw new Error('Joomla API is not properly initiated');
}
if (!this.getAttribute('uri')) {
throw new Error('No valid url for validation');
}
}
connectedCallback() {
const self = this;
const button = document.getElementById('sendtestmail');
if (button) {
button.addEventListener('click', () => {
self.sendTestMail(self);
});
}
}
sendTestMail() {
const email_data = {
smtpauth: this.querySelector('[name="jform[smtpauth]"]').value,
smtpuser: this.querySelector('[name="jform[smtpuser]"]').value,
smtppass: this.querySelector('[name="jform[smtppass]"]').value,
smtphost: this.querySelector('[name="jform[smtphost]"]').value,
smtpsecure: this.querySelector('[name="jform[smtpsecure]"]').value,
smtpport: this.querySelector('[name="jform[smtpport]"]').value,
mailfrom: this.querySelector('[name="jform[mailfrom]"]').value,
fromname: this.querySelector('[name="jform[fromname]"]').value,
mailer: this.querySelector('[name="jform[mailer]"]').value,
mailonline: this.querySelector('[name="jform[mailonline]"]').value
}; // Remove js messages, if they exist.
Joomla.removeMessages();
Joomla.request({
url: this.getAttribute('uri'),
method: 'POST',
data: JSON.stringify(email_data),
perform: true,
headers: {
'Content-Type': 'application/json'
},
onSuccess: (response, xhr) => {
response = JSON.parse(response);
if (typeof response.messages === 'object' && response.messages !== null) {
Joomla.renderMessages(response.messages);
}
},
onError: xhr => {
Joomla.renderMessages(Joomla.ajaxErrorsMessages(xhr));
}
});
}
}
customElements.define('joomla-field-send-test-mail', JoomlaFieldSendTestMail);
})(customElements, Joomla);
No other release has this exact content. See every version of this file.