This commit is contained in:
2018-07-17 19:39:55 +00:00
parent a22687ca16
commit c41838c813
13 changed files with 2057 additions and 308 deletions

View File

@@ -67,6 +67,28 @@ namespace rockfishCore.Controllers
return Json(new { msg = ex.Message, error = 1 }); return Json(new { msg = ex.Message, error = 1 });
} }
} }
[HttpPost("isspam/{account}/{id}")]
public JsonResult IsSpam([FromRoute] string account, [FromRoute] uint id)
{
RfMail.rfMailAccount acct = RfMail.rfMailAccount.support;
if (account.Contains("sales"))
{
acct = RfMail.rfMailAccount.sales;
}
try
{
RfMail.HandleSpamMessage(id, acct);
return Json(new { msg = "message processed as spam", ok = 1 });
}
catch (Exception ex)
{
return Json(new { msg = ex.Message, error = 1 });
}
}
// //------------------------------------------------------ // //------------------------------------------------------
public class dtoReplyMessageItem public class dtoReplyMessageItem

View File

@@ -9,6 +9,7 @@ using MailKit.Net.Imap;
using MailKit.Search; using MailKit.Search;
using MailKit; using MailKit;
using MimeKit; using MimeKit;
using MimeKit.Utils;
namespace rockfishCore.Util namespace rockfishCore.Util
{ {
@@ -108,6 +109,8 @@ namespace rockfishCore.Util
} }
public static void SendMessage(string MessageFrom, string MessageTo, string MessageSubject, string MessageBody, public static void SendMessage(string MessageFrom, string MessageTo, string MessageSubject, string MessageBody,
bool trackDeliveryStatus = false, string CustomHeader = "", string CustomHeaderValue = "") bool trackDeliveryStatus = false, string CustomHeader = "", string CustomHeaderValue = "")
{ {
@@ -151,6 +154,51 @@ namespace rockfishCore.Util
}//send message }//send message
#region handle spam message
/// <summary>
/// Forward a message to the isspam@ayanova.com address and then erase it
/// </summary>
/// <param name="spamMessageId"></param>
/// <param name="replyFromAccount"></param>
public static void HandleSpamMessage(uint spamMessageId, rfMailAccount replyFromAccount)
{
using (var client = new ImapClient())
{
// Accept all SSL certificates
client.ServerCertificateValidationCallback = (s, c, h, e) => true;
client.Connect(MAIL_IMAP_ADDRESS, MAIL_IMAP_PORT);
// Note: since we don't have an OAuth2 token, disable
// the XOAUTH2 authentication mechanism.
client.AuthenticationMechanisms.Remove("XOAUTH2");
if (replyFromAccount == rfMailAccount.support)
{
client.Authenticate(MAIL_ACCOUNT_SUPPORT, MAIL_ACCOUNT_PASSWORD_SUPPORT);
}
else
{
client.Authenticate(MAIL_ACCOUNT_SALES, MAIL_ACCOUNT_PASSWORD_SALES);
}
var spamFolder = client.GetFolder("Spam");
if (spamFolder != null){
client.Inbox.Open(FolderAccess.ReadWrite);
client.Inbox.MoveTo(new UniqueId(spamMessageId), spamFolder);
}
client.Disconnect(true);
}
}//spaminator
#endregion
public static void ReplyMessage(uint replyToMessageId, rfMailAccount replyFromAccount, string replyBody, public static void ReplyMessage(uint replyToMessageId, rfMailAccount replyFromAccount, string replyBody,
bool replyToAll, bool trackDeliveryStatus = false, string CustomHeader = "", string CustomHeaderValue = "") bool replyToAll, bool trackDeliveryStatus = false, string CustomHeader = "", string CustomHeaderValue = "")
{ {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -11,16 +11,16 @@
<title>Rockfish loading....</title> <title>Rockfish loading....</title>
<!-- ICONS / MANIFEST --> <!-- ICONS / MANIFEST -->
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?rfv=6.2"> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?rfv=6.3">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png?rfv=6.2"> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png?rfv=6.3">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png?rfv=6.2"> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png?rfv=6.3">
<link rel="manifest" href="/manifest.json?rfv=6.2"> <link rel="manifest" href="/manifest.json?rfv=6.3">
<link rel="mask-icon" href="/safari-pinned-tab.svg?rfv=6.2" color="#5bbad5"> <link rel="mask-icon" href="/safari-pinned-tab.svg?rfv=6.3" color="#5bbad5">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
<!-- 3rd party components fonts and icons --> <!-- 3rd party components fonts and icons -->
<link href="css/materialdesignicons.min.css?rfv=6.2" media="all" rel="stylesheet" type="text/css" /> <link href="css/materialdesignicons.min.css?rfv=6.3" media="all" rel="stylesheet" type="text/css" />
<!--BOOTSTRAP--> <!--BOOTSTRAP-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB"
@@ -29,60 +29,60 @@
crossorigin="anonymous"> --> crossorigin="anonymous"> -->
<link rel="stylesheet" href="css/app.css?rfv=6.2" type="text/css" /> <link rel="stylesheet" href="css/app.css?rfv=6.3" type="text/css" />
<link rel="stylesheet" href="css/mdi-bs4-compat.css?rfv=6.2" type="text/css" /> <link rel="stylesheet" href="css/mdi-bs4-compat.css?rfv=6.3" type="text/css" />
<!-- <script src="js/lib/jquery-3.2.1.min.js"></script> --> <!-- <script src="js/lib/jquery-3.2.1.min.js"></script> -->
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- third-party javascript --> <!-- third-party javascript -->
<script src="js/lib/page.js?rfv=6.2"></script> <script src="js/lib/page.js?rfv=6.3"></script>
<script src="js/lib/jquery.event.gevent.js?rfv=6.2"></script> <script src="js/lib/jquery.event.gevent.js?rfv=6.3"></script>
<script src="js/lib/jquery.gzserialize.js?rfv=6.2"></script> <script src="js/lib/jquery.gzserialize.js?rfv=6.3"></script>
<script src="js/lib/handlebars.runtime-v4.0.5.js?rfv=6.2"></script> <script src="js/lib/handlebars.runtime-v4.0.5.js?rfv=6.3"></script>
<script src="js/lib/store.min.js?rfv=6.2"></script> <script src="js/lib/store.min.js?rfv=6.3"></script>
<script src="js/lib/jquery.autocomplete.min.js?rfv=6.2"></script> <script src="js/lib/jquery.autocomplete.min.js?rfv=6.3"></script>
<script src="js/lib/moment.min.js?rfv=6.2"></script> <script src="js/lib/moment.min.js?rfv=6.3"></script>
<!-- our javascript --> <!-- our javascript -->
<!-- <script src="js/index.js?rfv=6.2"></script> --> <!-- <script src="js/index.js?rfv=6.3"></script> -->
<script src="js/index.js" asp-append-version="true"></script> <script src="js/index.js" asp-append-version="true"></script>
<script src="js/app.util.js?rfv=6.2"></script> <script src="js/app.util.js?rfv=6.3"></script>
<script src="js/app.api.js?rfv=6.2"></script> <script src="js/app.api.js?rfv=6.3"></script>
<script src="js/app.utilB.js?rfv=6.2"></script> <script src="js/app.utilB.js?rfv=6.3"></script>
<script src="js/app.nav.js?rfv=6.2"></script> <script src="js/app.nav.js?rfv=6.3"></script>
<script src="js/app.shell.js?rfv=6.2"></script> <script src="js/app.shell.js?rfv=6.3"></script>
<script src="js/app.fourohfour.js?rfv=6.2"></script> <script src="js/app.fourohfour.js?rfv=6.3"></script>
<script src="js/app.authenticate.js?rfv=6.2"></script> <script src="js/app.authenticate.js?rfv=6.3"></script>
<script src="js/app.customers.js?rfv=6.2"></script> <script src="js/app.customers.js?rfv=6.3"></script>
<script src="js/app.customerEdit.js?rfv=6.2"></script> <script src="js/app.customerEdit.js?rfv=6.3"></script>
<script src="js/app.customerSites.js?rfv=6.2"></script> <script src="js/app.customerSites.js?rfv=6.3"></script>
<script src="js/app.customerSiteEdit.js?rfv=6.2"></script> <script src="js/app.customerSiteEdit.js?rfv=6.3"></script>
<script src="js/app.purchases.js?rfv=6.2"></script> <script src="js/app.purchases.js?rfv=6.3"></script>
<script src="js/app.purchaseEdit.js?rfv=6.2"></script> <script src="js/app.purchaseEdit.js?rfv=6.3"></script>
<script src="js/app.license.js?rfv=6.2"></script> <script src="js/app.license.js?rfv=6.3"></script>
<script src="js/app.licenseTemplates.js?rfv=6.2"></script> <script src="js/app.licenseTemplates.js?rfv=6.3"></script>
<script src="js/app.licenseRequestEdit.js?rfv=6.2"></script> <script src="js/app.licenseRequestEdit.js?rfv=6.3"></script>
<script src="js/app.licenses.js?rfv=6.2"></script> <script src="js/app.licenses.js?rfv=6.3"></script>
<script src="js/app.licenseView.js?rfv=6.2"></script> <script src="js/app.licenseView.js?rfv=6.3"></script>
<script src="js/app.reportData.js?rfv=6.2"></script> <script src="js/app.reportData.js?rfv=6.3"></script>
<script src="js/app.reportDataProdEmail.js?rfv=6.2"></script> <script src="js/app.reportDataProdEmail.js?rfv=6.3"></script>
<script src="js/app.reportDataExpires.js?rfv=6.2"></script> <script src="js/app.reportDataExpires.js?rfv=6.3"></script>
<script src="js/app.search.js?rfv=6.2"></script> <script src="js/app.search.js?rfv=6.3"></script>
<script src="js/app.subscription.js?rfv=6.2"></script> <script src="js/app.subscription.js?rfv=6.3"></script>
<script src="js/app.subnotify.js?rfv=6.2"></script> <script src="js/app.subnotify.js?rfv=6.3"></script>
<script src="js/app.templates.js?rfv=6.2"></script> <script src="js/app.templates.js?rfv=6.3"></script>
<script src="js/app.templateEdit.js?rfv=6.2"></script> <script src="js/app.templateEdit.js?rfv=6.3"></script>
<script src="js/app.inbox.js?rfv=6.2"></script> <script src="js/app.inbox.js?rfv=6.3"></script>
<script src="js/app.mailEdit.js?rfv=6.2"></script> <script src="js/app.mailEdit.js?rfv=6.3"></script>
<script src="js/app.rfcaseEdit.js?rfv=6.2"></script> <script src="js/app.rfcaseEdit.js?rfv=6.3"></script>
<script src="js/app.rfcases.js?rfv=6.2"></script> <script src="js/app.rfcases.js?rfv=6.3"></script>
<script src="js/app.rfsettings.js?rfv=6.2"></script> <script src="js/app.rfsettings.js?rfv=6.3"></script>
<!-- handlebars templates --> <!-- handlebars templates -->
<script src="js/templates/templates.js?rfv=6.2"></script> <script src="js/templates/templates.js?rfv=6.3"></script>
<script> <script>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

View File

@@ -8,15 +8,15 @@
/*global $, app */ /*global $, app */
app.mailEdit = (function() { app.mailEdit = (function() {
'use strict'; "use strict";
//---------------- BEGIN MODULE SCOPE VARIABLES -------------- //---------------- BEGIN MODULE SCOPE VARIABLES --------------
var var stateMap = {},
stateMap = {}, onSend,
onSave, onDelete, onSend, onSpam,
configModule, initModule; configModule,
initModule;
//----------------- END MODULE SCOPE VARIABLES --------------- //----------------- END MODULE SCOPE VARIABLES ---------------
//------------------- BEGIN EVENT HANDLERS ------------------- //------------------- BEGIN EVENT HANDLERS -------------------
/////////////////////////////////// ///////////////////////////////////
@@ -25,7 +25,7 @@ app.mailEdit = (function () {
onSend = function(event) { onSend = function(event) {
event.preventDefault(); event.preventDefault();
$.gevent.publish('app-clear-error'); $.gevent.publish("app-clear-error");
//get form data //get form data
var formData = $("form").serializeArray({ var formData = $("form").serializeArray({
@@ -36,19 +36,24 @@ app.mailEdit = (function () {
var submitData = app.utilB.objectifyFormDataArray(formData); var submitData = app.utilB.objectifyFormDataArray(formData);
//is this a new record? //is this a new record?
if (stateMap.id != 'new') { if (stateMap.id != "new") {
//put id into the form data //put id into the form data
// submitData.id = stateMap.id; // submitData.id = stateMap.id;
app.api.create('mail/reply/' + app.api.create(
"mail/reply/" +
stateMap.context.params.mail_account + stateMap.context.params.mail_account +
'/' + stateMap.context.params.mail_id, submitData, function (res) { "/" +
stateMap.context.params.mail_id,
submitData,
function(res) {
if (res.error) { if (res.error) {
$.gevent.publish('app-show-error', res.msg); $.gevent.publish("app-show-error", res.msg);
} else { } else {
page('#!/inbox'); page("#!/inbox");
} }
}); }
);
} else { } else {
alert("STUB: New message composition not implemented yet"); alert("STUB: New message composition not implemented yet");
// //it's a new record - create // //it's a new record - create
@@ -61,19 +66,45 @@ app.mailEdit = (function () {
// }); // });
} }
return false;
};
///////////////////////////////////
// SPAM HANDLER
//
onSpam = function(event) {
event.preventDefault();
$.gevent.publish("app-clear-error");
//is this a new record?
if (stateMap.id == "new") {
alert("New message spam handling makes no sense - figure it out!");
return false;
}
app.api.create(
"mail/isspam/" +
stateMap.context.params.mail_account +
"/" +
stateMap.context.params.mail_id,
null,
function(res) {
if (res.error) {
$.gevent.publish("app-show-error", res.msg);
} else {
page("#!/inbox");
}
}
);
return false; return false;
}; };
//ONDELETE
//
//removed
//-------------------- END EVENT HANDLERS -------------------- //-------------------- END EVENT HANDLERS --------------------
//------------------- BEGIN PUBLIC METHODS ------------------- //------------------- BEGIN PUBLIC METHODS -------------------
//CONFIGMODULE //CONFIGMODULE
// //
configModule = function(context) { configModule = function(context) {
@@ -86,11 +117,11 @@ app.mailEdit = (function () {
//INITMODULE //INITMODULE
// //
initModule = function($container) { initModule = function($container) {
if (typeof $container === 'undefined') { if (typeof $container === "undefined") {
$container = $('#app-shell-main-content'); $container = $("#app-shell-main-content");
} }
$container.html(Handlebars.templates['app.mailEdit']({})); $container.html(Handlebars.templates["app.mailEdit"]({}));
// stateMap.replyMode = false; // stateMap.replyMode = false;
// if (stateMap.context.querystring.endsWith('reply')) { // if (stateMap.context.querystring.endsWith('reply')) {
// stateMap.replyMode = true; // stateMap.replyMode = true;
@@ -100,42 +131,42 @@ app.mailEdit = (function () {
app.nav.contextAddLink("inbox/", "Inbox", "inbox"); app.nav.contextAddLink("inbox/", "Inbox", "inbox");
//id should always have a value, either a record id or the keyword 'new' for making a new object //id should always have a value, either a record id or the keyword 'new' for making a new object
if (stateMap.id != 'new') { if (stateMap.id != "new") {
//fetch existing record //fetch existing record
app.api.get( app.api.get(
'mail/preview/' + "mail/preview/" +
stateMap.context.params.mail_account + stateMap.context.params.mail_account +
'/' + stateMap.context.params.mail_folder + "/" +
'/' + stateMap.context.params.mail_id, function (res) { stateMap.context.params.mail_folder +
"/" +
stateMap.context.params.mail_id,
function(res) {
if (res.error) { if (res.error) {
// app.nav.contextClear(); // app.nav.contextClear();
// app.nav.contextAddLink("inbox/", "Inbox", "inbox"); // app.nav.contextAddLink("inbox/", "Inbox", "inbox");
$.gevent.publish('app-show-error', res.msg); $.gevent.publish("app-show-error", res.msg);
} else { } else {
//fill out form //fill out form
// app.nav.contextClear(); // app.nav.contextClear();
//app.nav.contextAddLink("inbox/", "Inbox", "inbox"); //app.nav.contextAddLink("inbox/", "Inbox", "inbox");
$('#message').text(res.preview); $("#message").text(res.preview);
if (res.isKeyRequest) { if (res.isKeyRequest) {
app.nav.contextAddLink("licenseRequestEdit/" + res.id, "Make", "key"); app.nav.contextAddLink(
"licenseRequestEdit/" + res.id,
"Make",
"key"
);
} else { } else {
$('#composition').text("\n\n- John\nwww.ayanova.com"); $("#composition").text("\n\n- John\nwww.ayanova.com");
} }
} }
}); }
);
$('#btn-send').bind('click', onSend); $("#btn-send").bind("click", onSend);
//Context menu //Context menu
app.nav.contextAddButton("btn-generate", "IsSpam", "axe", onSpam);
//app.nav.contextAddButton('btn-send', 'Send reply', 'send', onSend);
// app.nav.contextAddButton('btn-generate', 'Build', 'key', onReply);
// app.nav.contextAddLink("customerSites/" + stateMap.id, "Sites", "city");//url title icon
} else { } else {
//NEW email options //NEW email options
var $group = $("#sendToGroup"); var $group = $("#sendToGroup");
@@ -145,11 +176,8 @@ app.mailEdit = (function () {
// app.nav.contextAddLink("inbox/", "Inbox", "inbox"); // app.nav.contextAddLink("inbox/", "Inbox", "inbox");
// app.nav.contextAddButton('btn-send', 'Send', 'send', onSend); // app.nav.contextAddButton('btn-send', 'Send', 'send', onSend);
} }
}; };
// RETURN PUBLIC METHODS // RETURN PUBLIC METHODS
// //
return { return {
@@ -157,4 +185,4 @@ app.mailEdit = (function () {
initModule: initModule initModule: initModule
}; };
//------------------- END PUBLIC METHODS --------------------- //------------------- END PUBLIC METHODS ---------------------
}()); })();