Skip to content
Snippets Groups Projects
Commit 89ce6a7c authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

Merge branch '1080134_redirect_in_testrun' into '2021.0'

[Projekt: xRM-Marketing][TicketNr.: 1080134][Fehler bei Redirectlinks im Testversand]

See merge request xrm/basic!900
parents 4c8607e6 5eb239b1
No related branches found
No related tags found
No related merge requests found
......@@ -234,6 +234,7 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun)
let isSuccess = false;
let contactId = recipientData[i]["CONTACT_ID"];
let email = mails[contactId];
let currentMailLogId = mailLogIds.get(contactId);
if (email !== undefined)
{
......@@ -244,15 +245,28 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun)
if(testRecipientData[j][1])
{
email.toRecipients = [testRecipientData[j][1]];
let nextMailLogId = util.getNewUUID();
email.body = email.body.replace(currentMailLogId,nextMailLogId);
currentMailLogId = nextMailLogId;
isSuccess = email.send();
Array.prototype.push.call(isSuccess ? successIds : failedIds, recipientData[i]["BULKMAILRECIPIENTID"]);
if (testRecipientData[j][0])
{
let mailLogId = util.getNewUUID();
db.insertData("MAIL_LOG", ["MAIL_LOGID","MAIL_RUN_ID","CONTACT_ID","STATUS","SENDER_EMAIL","RECIPIENT_EMAIL","MAILING_SUBJECT","DATE_SEND"], null, [mailLogId,mailrunId,testRecipientData[j][0],(isSuccess ?$KeywordRegistry.bulkMailRecipientStatus$sent(): $KeywordRegistry.bulkMailRecipientStatus$failed()),emailSender,testRecipientData[j][1],email.subject,vars.get("$sys.date")]);
this.storeEmlFile(pBulkMailId, mailrunId, mailLogId,email.getEML());
new SqlBuilder()
.tableName("MAIL_LOG")
.insertFields({
"MAIL_LOGID":nextMailLogId,
"MAIL_RUN_ID":mailrunId,
"CONTACT_ID":testRecipientData[j][0],
"STATUS":(isSuccess ?$KeywordRegistry.bulkMailRecipientStatus$sent(): $KeywordRegistry.bulkMailRecipientStatus$failed()),
"SENDER_EMAIL":emailSender,
"RECIPIENT_EMAIL":testRecipientData[j][1],
"MAILING_SUBJECT":email.subject,
"DATE_SEND":vars.get("$sys.date")
});
this.storeEmlFile(pBulkMailId, mailrunId, nextMailLogId,email.getEML());
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment