Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
basic
Commits
972bd6d4
Commit
972bd6d4
authored
5 years ago
by
Johannes Hörmann
Browse files
Options
Downloads
Patches
Plain Diff
try to generate eml from original eml
parent
846ed756
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
process/Bulkmail_lib/process.js
+401
-390
401 additions, 390 deletions
process/Bulkmail_lib/process.js
process/Email_lib/process.js
+30
-7
30 additions, 7 deletions
process/Email_lib/process.js
with
431 additions
and
397 deletions
process/Bulkmail_lib/process.js
+
401
−
390
View file @
972bd6d4
This diff is collapsed.
Click to expand it.
process/Email_lib/process.js
+
30
−
7
View file @
972bd6d4
...
...
@@ -61,14 +61,15 @@ EmailWritingUtils.getMailbridgeAddress = function ()
* object for handling emails
*
* @param {String|Array} [pToRecipients=[]] recipient email address or array of recipient email addresses
* @param {String} [pSender=
null
] email address of the sender
* @param {String} [pSubject=
null
] subject
* @param {String} [pBody=
null
] mail body
* @param {String} [pSender=
undefined
] email address of the sender
* @param {String} [pSubject=
undefined
] subject
* @param {String} [pBody=
undefined
] mail body
* @param {Array} [pCcRecipients=[]] array of recipient cc addresses
* @param {Array} [pBccRecipients=[]] array of recipient bcc addresses
* @param {String} [pOriginalRfcBase64=undefined] if existing, this file is used as base for creating an eml
* @class
*/
function
Email
(
pToRecipients
,
pSender
,
pSubject
,
pBody
,
pCcRecipients
,
pBccRecipients
)
function
Email
(
pToRecipients
,
pSender
,
pSubject
,
pBody
,
pCcRecipients
,
pBccRecipients
,
pOriginalRfcBase64
)
{
if
(
pToRecipients
&&
typeof
(
pToRecipients
)
==
"
string
"
)
pToRecipients
=
[
pToRecipients
];
...
...
@@ -79,6 +80,7 @@ function Email (pToRecipients, pSender, pSubject, pBody, pCcRecipients, pBccReci
this
.
toRecipients
=
pToRecipients
||
[];
this
.
ccRecipients
=
pCcRecipients
||
[];
this
.
bccRecipients
=
pBccRecipients
||
[];
this
.
originalRfc
=
pOriginalRfcBase64
;
}
/**
...
...
@@ -94,7 +96,7 @@ Email.fromRFC = function (pBase64RFC)
var
sender
=
mailData
[
mail
.
MAIL_SENDER
];
var
subject
=
mailData
[
mail
.
MAIL_SUBJECT
];
return
new
Email
(
null
,
sender
,
subject
,
body
);
return
new
Email
(
null
,
sender
,
subject
,
body
,
undefined
,
undefined
,
pBase64RFC
);
}
/**
...
...
@@ -112,10 +114,18 @@ Email.prototype.setTemplate = function (pTemplateId, pContactId, pBindata)
if
(
BulkMailUtils
.
isValidMimeType
(
pBindata
.
mimeType
))
{
template
=
new
DocumentTemplate
(
pBindata
.
bindata
,
DocumentTemplate
.
types
.
fromMimeType
(
pBindata
.
mimeType
),
pBindata
.
filename
,
true
);
this
.
originalRfc
=
pBindata
.
bindata
;
}
}
else
{
template
=
DocumentTemplate
.
loadTemplate
(
pTemplateId
);
if
(
BulkMailUtils
.
isValidTemplateType
(
template
.
type
))
{
this
.
originalRfc
=
template
.
content
;
}
}
var
email
=
template
.
getReplacedEmailsByContactIds
([
pContactId
])[
pContactId
];
this
.
sender
=
email
.
sender
;
this
.
body
=
email
.
body
;
...
...
@@ -164,18 +174,31 @@ Email.prototype.getMailtoUrl = function ()
*/
Email
.
prototype
.
getRFCmail
=
function
()
{
// disable generating mail via originalRfc for now as it doesn*t work as expected.
// --> undefined
this
.
originalRfc
=
undefined
var
ENCODING
=
"
UTF-8
"
;
var
mailId
;
var
originalRfcDecoded
=
this
.
originalRfc
?
util
.
decodeBase64String
(
this
.
originalRfc
)
:
null
;
logging
.
log
(
originalRfcDecoded
.
substr
(
0
,
300
));
try
{
mailId
=
mail
.
newMail
();
if
(
originalRfcDecoded
)
mailId
=
mail
.
newMail
(
originalRfcDecoded
,
mail
.
FORMAT_MIME
);
else
mailId
=
mail
.
newMail
();
}
catch
(
ex
)
{
//TODO: fix this dirty workaround [waiting for #1038963], since newMail causes an error on the first call after a user logged in
logging
.
log
(
ex
);
util
.
sleep
(
1500
);
mailId
=
mail
.
newMail
();
if
(
originalRfcDecoded
)
mailId
=
mail
.
newMail
(
originalRfcDecoded
,
mail
.
FORMAT_MIME
);
else
mailId
=
mail
.
newMail
();
}
...
...
This diff is collapsed.
Click to expand it.
Johannes Hörmann
@j.hoermann
mentioned in commit
9c2e0253
·
5 years ago
mentioned in commit
9c2e0253
mentioned in commit 9c2e02537e71d01190b3bbb103a3bc72c96b2b42
Toggle commit list
Johannes Hörmann
@j.hoermann
mentioned in commit
e4d2965d
·
5 years ago
mentioned in commit
e4d2965d
mentioned in commit e4d2965d59ca9188a59e8874d27d3355ef854f56
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment