CoreFiles by mySites.guru
sendtestmail.js54 lines, 1,855 bytes, from Joomla_4.0.0-alpha2-Alpha-Full_Package.zip
Raw History Compare with 3.10.0-alpha9
md5
4980f0b7f247c059693916aa46cf5520
sha1
aaedaeece25379e7c853efab74be9dda97db1f9e
sha256
1af021f8414d6f0ad3de0d19187688a0cc1bf7dea367fbd34a0686cfa37c665d
/**
 * @package         Joomla.JavaScript
 * @copyright       Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 * @license         GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * Calls the sending process of the config class
 */
"use strict";

var sendTestMail = function() {

	var email_data = {
		smtpauth  : document.querySelector('[name="jform[smtpauth]"]').value,
		smtpuser  : document.querySelector('[name="jform[smtpuser]"]').value,
		smtppass  : document.querySelector('[name="jform[smtppass]"]').value,
		smtphost  : document.querySelector('[name="jform[smtphost]"]').value,
		smtpsecure: document.querySelector('[name="jform[smtpsecure]"]').value,
		smtpport  : document.querySelector('[name="jform[smtpport]"]').value,
		mailfrom  : document.querySelector('[name="jform[mailfrom]"]').value,
		fromname  : document.querySelector('[name="jform[fromname]"]').value,
		mailer    : document.querySelector('[name="jform[mailer]"]').value,
		mailonline: document.querySelector('[name="jform[mailonline]"]').value
	};

	// Remove js messages, if they exist.
	Joomla.removeMessages();

	Joomla.request(
		{
			url:    document.getElementById('sendtestmail').getAttribute('data-ajaxuri'),
			method: 'POST',
			data:    JSON.stringify(email_data),
			perform: true,
			headers: {'Content-Type': 'application/x-www-form-urlencoded'},
			onSuccess: function(response, xhr)
			{
				response = JSON.parse(response);
				if (typeof response.messages == 'object' && response.messages !== null) {
					Joomla.renderMessages(response.messages);
				}
			},
			onError: function(xhr)
			{
				Joomla.renderMessages(Joomla.ajaxErrorsMessages(xhr));
			}
		}
	);
};

document.addEventListener('DOMContentLoaded', function() {
	document.getElementById('sendtestmail').addEventListener('click', sendTestMail);
});

No other release has this exact content. See every version of this file.