Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Main
Synchronet
Commits
50316a14
Commit
50316a14
authored
21 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Examle SMTP mail processor.
parent
fa9f98cd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/mailproc_example.js
+46
-0
46 additions, 0 deletions
exec/mailproc_example.js
with
46 additions
and
0 deletions
exec/mailproc_example.js
0 → 100644
+
46
−
0
View file @
50316a14
// mailproc_example.js
// Example SMTP "Mail Processor" module
// Requires Synchronet Mail Server 1.298 or later
// $Id$
// Set to false at any time to indicate a processing failure
var
success
=
true
;
// These lines open the processing error output file as a new File object.
// If there are any processing errors (e.g. filtered context, blocked sender),
// you can reject the message by simply writing some text to 'errfile'.
var
errfile
=
new
File
(
processing_error_filename
);
if
(
!
errfile
.
open
(
"
w
"
))
exit
();
// These lines read the recipient list into a new 'recipient' object array.
var
rcptlst
=
new
File
(
recipient_list_filename
);
if
(
!
rcptlst
.
open
(
"
r
"
))
exit
();
var
recipient
=
rcptlst
.
iniGetAllObjects
(
"
number
"
);
// At this point we can access the list of recipients very easily
// using the 'recipient' object array.
// These lines open the message text file in append mode (writing to the end)
var
msgtxt
=
new
File
(
message_text_filename
);
if
(
!
msgtxt
.
open
(
"
a
"
))
// Change thie mode to "r+" for "read/update" access
exit
();
// This an example of modifying the message text.
// In this case, we're adding some text (a dump of the recipient object array)
// to the end of the message.
msgtxt
.
writeln
(
"
\r\n
Hello from mailproc_example.js
\r\n
"
);
msgtxt
.
writeln
(
"
Array of recipient objects (message envelopes):
\r\n
"
);
// Dump recipient object array
for
(
i
in
recipient
)
// For each recipient object...
for
(
j
in
recipient
[
i
])
// For each property...
msgtxt
.
writeln
(
"
recipient[
"
+
i
+
"
].
"
+
j
+
"
=
"
+
recipient
[
i
][
j
]);
// If there were any processing errors... reject the message
if
(
!
success
)
errfile
.
writeln
(
"
A mail processing error occurred. Message rejected.
"
);
// End of mailproc_example.js
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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