summaryrefslogtreecommitdiffstats
path: root/include/functions.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2009-02-13 23:40:26 -0800
committerArun Persaud <arun@nubati.net>2009-02-23 21:32:21 -0800
commitd661e260855977d34672388cfa8766de55a73f93 (patch)
tree4cf71a8f98d37a2adcf5d4cd97d06536eb86467b /include/functions.php
parentf7e3acc9f015115707b7b6d59d8ebdb2522b9d0d (diff)
downloade-DoKo-d661e260855977d34672388cfa8766de55a73f93.tar.gz
e-DoKo-d661e260855977d34672388cfa8766de55a73f93.tar.bz2
e-DoKo-d661e260855977d34672388cfa8766de55a73f93.zip
CLEANUP: make emails more uniform
provide a standard header and footer. Also prepare for emails to be send to the database for later delivery.
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php43
1 files changed, 41 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php
index f982029..7141ec7 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -54,10 +54,49 @@ function config_check()
return;
}
-function mymail($To,$Subject,$message,$header="")
+function mymail($uid,$subject,$message)
{
+ global $EmailName;
+
+ /* check if user wants email right away or if we should save it in
+ * the database for later delivery
+ */
+ if(0)
+ {
+ /* send to database (not yet implemented)*/
+ }
+ else
+ {
+ /* send email right away */
+
+ /* add standard header and footer */
+ $subject = "$EmailName".$subject;
+
+ /* standard greeting */
+ $header = "Hello ...\n\n";
+
+ /* and standard goodbye */
+ $footer = "\n\nHave a nice day\n".
+ " your E-Doko service department\n\n".
+ "-- \n".
+ "You can change your mail delivery mode in the preference menu.\n".
+ 'web: http://doko.nubati.net '.
+ 'help: http://wiki.nubati.net/EmailDoko '.
+ 'bugs: http://wiki.nubati.net/EmailDokoIssues';
+
+ $To = DB_get_email('userid',$uid);
+
+ sendmail($To,$subject,$header.$message.$footer);
+ }
+}
+
+function sendmail($To,$Subject,$message)
+{
+ /* this function sends the mail or outputs to the screen in case of debugging */
global $debug,$EMAIL_REPLY;
+ $header = "";
+
if(isset($EMAIL_REPLY))
$header .= "From: e-DoKo daemon <$EMAIL_REPLY>\r\n";
@@ -104,7 +143,7 @@ function myisset()
function myerror($message)
{
echo "<span class=\"error\">".htmlspecialchars($message)."</span>\n";
- mymail($ADMIN_EMAIL,$EmailName." Error in Code",$message);
+ sendmail($ADMIN_EMAIL,$EmailName." Error in Code",$message);
return;
}