Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-core
Commits
eb8c9b87
Commit
eb8c9b87
authored
Sep 05, 2004
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- altert-procs updated after bugfix in projop because
of error to handle email from ananymous user (crm-tracking)
parent
a1434d06
Pipeline
#1067
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
20 deletions
+18
-20
intranet-alert-procs.tcl
tcl/intranet-alert-procs.tcl
+18
-20
No files found.
tcl/intranet-alert-procs.tcl
View file @
eb8c9b87
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
ad_library
{
ad_library
{
API for sending out email alerts for various Intranet functions
API for sending out email alerts for various Intranet functions
@author unknown@arsdigita.com
@author unknown@arsdigita.com
@author frank.bergmann@project-open.com
@author frank.bergmann@project-open.com
}
}
...
@@ -24,7 +24,6 @@ ad_library {
...
@@ -24,7 +24,6 @@ ad_library {
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# Add an alert to the database alert queue
# Add an alert to the database alert queue
# -------------------------------------------------------------------
# -------------------------------------------------------------------
ad_proc im_send_alert
{
target_id frequency subject
{
message
""
}
}
{
ad_proc im_send_alert
{
target_id frequency subject
{
message
""
}
}
{
Add a new alert to the queue for a specific user.
Add a new alert to the queue for a specific user.
The idea is to aggregate several alerts into a single email,
The idea is to aggregate several alerts into a single email,
...
@@ -35,7 +34,7 @@ ad_proc im_send_alert {target_id frequency subject {message ""} } {
...
@@ -35,7 +34,7 @@ ad_proc im_send_alert {target_id frequency subject {message ""} } {
intermediate header.
intermediate header.
The
"message"
is suposed to be plain text only. We are going to
The
"message"
is suposed to be plain text only. We are going to
preserve line break, but we will add a
"
\t
"
before each line.
preserve line break, but we will add a
"
\t
"
before each line.
"Frequency"
can be one of: now
(
minutely
)
, hourly, daily, weekly,
"Frequency"
can be one of: now
(
minutely
)
, hourly, daily, weekly,
biweekly, monthly, trimesterly, semesterly, yearly.
biweekly, monthly, trimesterly, semesterly, yearly.
}
{
}
{
# Quick & Dirty implementation: just send out the mail immediately,
# Quick & Dirty implementation: just send out the mail immediately,
...
@@ -46,30 +45,29 @@ ad_proc im_send_alert {target_id frequency subject {message ""} } {
...
@@ -46,30 +45,29 @@ ad_proc im_send_alert {target_id frequency subject {message ""} } {
# Get the email of the target user
# Get the email of the target user
set user_email_sql
"select email from parties where party_id = :target_id"
set user_email_sql
"select email from parties where party_id = :target_id"
db_transaction
{
db_transaction
{
db_1row user_email
$user
_email_sql
db_1row user_email
$user
_email_sql
}
on_error
{
}
on_error
{
ad_return_complaint 1
"<li>Error getting the email address of user
$target
_id"
ad_return_complaint 1
"<li>Error getting the email address of user
$target
_id"
return
return
}
}
# Determine the sender address
# Determine the sender address
set sender_email_sql
"select email as sender_email from parties where party_id = :current_user_id"
set sender_email
[
ad_parameter -package_id
[
ad_acs_kernel_id
]
SystemOwner
""
"webmaster@local
\
db_transaction
{
host"
]
db_1row sender_email
$sender
_email_sql
if
[
catch
{
}
on_error
{
set sender_email
[
db_string sender_email
"select email as sender_email from parties where
\
set sender_email
[
ad_parameter -package_id
[
ad_acs_kernel_id
]
SystemOwner
""
"webmaster@localhost"
]
party_id = :current_user_id"
-default
"asfd@asdf.com"
]
}
}
errmsg
]
{
if
{
""
==
$sender
_email
}
{
# nothing - use default
ad_return_complaint 1
"<li>Error getting the email of user
$current
_user_id"
return
}
}
# Send out the mail
# Send out the mail
if
[
catch
{
if
[
catch
{
ns_sendmail
$email
$sender
_email
$subject
$message
ns_sendmail
$email
$sender
_email
$subject
$message
}
errmsg
]
{
}
errmsg
]
{
ns_log Notice
"im_send_alert: Error sending to
\"
$email
\"
:
$errmsg
"
ns_log Notice
"im_send_alert: Error sending to
\"
$email
\"
:
$errmsg
"
}
else
{
}
else
{
ns_log Notice
"im_send_alert: Sent mail to
$email
\n
"
ns_log Notice
"im_send_alert: Sent mail to
$email
\n
"
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment