Fix: Email notification testing.

pull/2/head
Mark McDowall 13 years ago
parent d79fa1c2cd
commit c9fcde3bbb

@ -90,7 +90,7 @@ namespace NzbDrone.Core.Providers
credentials = new NetworkCredential(username, password);
//Send the email
return Send(email, _configProvider.SmtpServer, _configProvider.SmtpPort, _configProvider.SmtpUseSsl, credentials);
return Send(email, server, port, ssl, credentials);
}
//TODO: make this throw instead of return false.

@ -68,10 +68,10 @@ namespace NzbDrone.Web.Controllers
}
[HttpPost]
public JsonResult SendTestEmail(string server, int port, bool ssl, string username, string password, string fromAddress, string toAddresses)
public JsonResult TestEmail(string server, int port, bool ssl, string username, string password, string fromAddress, string toAddresses)
{
if (_smtpProvider.SendTestEmail(server, port, ssl, username, password, fromAddress, toAddresses))
JsonNotificationResult.Info("Successful", "Test email sent.");
return JsonNotificationResult.Info("Successful", "Test email sent.");
return JsonNotificationResult.Oops("Couldn't send Email, please check your settings");
}

@ -8,6 +8,7 @@ $('#MultiEpisodeStyle').live('change', function () { createExamples(); });
var testProwlUrl = '../Command/TestProwl';
var testSabUrl = '../Command/TestSabnzbd';
var testEmailUrl = '../Command/TestEmail';
function createExamples() {
@ -133,4 +134,93 @@ function testSabnzbd(event) {
});
event.preventDefault();
}
//Twitter
getAuthorizationUrl = '../Command/GetTwitterAuthorization';
verifyAuthorizationUrl = '../Command/VerifyTwitterAuthorization';
function requestTwitterAuthorization() {
$.ajax({
type: "GET",
url: getAuthorizationUrl,
error: function (req, status, error) {
alert("Sorry! We could get Twitter Authorization at this time. " + error);
},
success: function (data, textStatus, jqXHR) {
if (data.IsMessage)
return false;
$('#authorizationRequestToken').val(data.Token);
window.open(data.Url);
}
});
}
function verifyTwitterAuthorization() {
var token = $('#authorizationRequestToken').val();
var verifier = $('#twitterVerification').val();
$.ajax({
type: "GET",
url: verifyAuthorizationUrl,
data: jQuery.param({ token: token, verifier: verifier }),
error: function (req, status, error) {
alert("Sorry! We could verify Twitter Authorization at this time. " + error);
}
});
}
//SMTP
function testSmtpSettings() {
//Get the variables
var server = $('#SmtpServer').val();
var port = $('#SmtpPort').val();
var ssl = $('#SmtpUseSsl').val();
var username = $('#SmtpUsername').val();
var password = $('#SmtpPassword').val();
var fromAddress = $('#SmtpFromAddress').val();
var toAddresses = $('#SmtpToAddresses').val();
//Send the data!
$.ajax({
type: "POST",
url: testEmailUrl,
data: jQuery.param({
server: server,
port: port,
ssl: ssl,
username: username,
password: password,
fromAddress: fromAddress,
toAddresses: toAddresses
}),
error: function (req, status, error) {
alert("Sorry! We could send a test email at this time. " + error);
}
});
return false;
}
//Growl
function registerGrowl() {
//Get the variables
var host = $('#GrowlHost').val();
var password = $('#GrowlPassword').val();
//Send the data!
$.ajax({
type: "POST",
url: '../Command/RegisterGrowl',
data: jQuery.param({
host: host,
password: password
}),
error: function (req, status, error) {
alert("Sorry! We could send a test email at this time. " + error);
}
});
return false;
}

@ -88,93 +88,4 @@
if ($(container).children('.input-validation-error').length == 0)
$(container).prev('h3.ui-accordion-header').removeClass('validation-error');
});
//Twitter
getAuthorizationUrl = '../Command/GetTwitterAuthorization';
verifyAuthorizationUrl = '../Command/VerifyTwitterAuthorization';
function requestTwitterAuthorization() {
$.ajax({
type: "GET",
url: getAuthorizationUrl,
error: function (req, status, error) {
alert("Sorry! We could get Twitter Authorization at this time. " + error);
},
success: function (data, textStatus, jqXHR) {
if (data.IsMessage)
return false;
$('#authorizationRequestToken').val(data.Token);
window.open(data.Url);
}
});
}
function verifyTwitterAuthorization() {
var token = $('#authorizationRequestToken').val();
var verifier = $('#twitterVerification').val();
$.ajax({
type: "GET",
url: verifyAuthorizationUrl,
data: jQuery.param({ token: token, verifier: verifier }),
error: function (req, status, error) {
alert("Sorry! We could verify Twitter Authorization at this time. " + error);
}
});
}
//SMTP
function testSmtpSettings() {
//Get the variables
var server = $('#SmtpServer').val();
var port = $('#SmtpPort').val();
var ssl = $('#SmtpUseSsl').val();
var username = $('#SmtpUsername').val();
var password = $('#SmtpPassword').val();
var fromAddress = $('#SmtpFromAddress').val();
var toAddresses = $('#SmtpToAddresses').val();
//Send the data!
$.ajax({
type: "POST",
url: '../Command/SendTestEmail',
data: jQuery.param({
server: server,
port: port,
ssl: ssl,
username: username,
password: password,
fromAddress: fromAddress,
toAddresses: toAddresses
}),
error: function (req, status, error) {
alert("Sorry! We could send a test email at this time. " + error);
}
});
return false;
}
//Growl
function registerGrowl() {
//Get the variables
var host = $('#GrowlHost').val();
var password = $('#GrowlPassword').val();
//Send the data!
$.ajax({
type: "POST",
url: '../Command/RegisterGrowl',
data: jQuery.param({
host: host,
password: password
}),
error: function (req, status, error) {
alert("Sorry! We could send a test email at this time. " + error);
}
});
return false;
}
</script>

Loading…
Cancel
Save