]> git.mxchange.org Git - friendica.git/blob - include/enotify.php
Merge remote-tracking branch 'upstream/master'
[friendica.git] / include / enotify.php
1 <?php
2
3 require_once('include/email.php');
4
5 function notification($params) {
6
7         logger('notification: entry', LOGGER_DEBUG);
8
9         $a = get_app();
10
11         // from here on everything is in the recipients language
12
13         push_lang($params['language']);
14
15
16         $banner = t('Friendica Notification');
17         $product = FRIENDICA_PLATFORM;
18         $siteurl = $a->get_baseurl(true);
19         $thanks = t('Thank You,');
20         $sitename = $a->config['sitename'];
21         $site_admin = sprintf( t('%s Administrator'), $sitename);
22
23         $sender_name = $product;
24         $hostname = $a->get_hostname();
25         if(strpos($hostname,':'))
26                 $hostname = substr($hostname,0,strpos($hostname,':'));
27
28         $sender_email = t('noreply') . '@' . $hostname;
29         $additional_mail_header = "";
30
31         if(array_key_exists('item',$params)) {
32                 $title = $params['item']['title'];
33                 $body = $params['item']['body'];
34         }
35         else {
36                 $title = $body = '';
37         }
38
39         // e.g. "your post", "David's photo", etc.
40         $possess_desc = t('%s <!item_type!>');
41
42         if($params['type'] == NOTIFY_MAIL) {
43
44                 $subject =      sprintf( t('[Friendica:Notify] New mail received at %s'),$sitename);
45
46                 $preamble = sprintf( t('%1$s sent you a new private message at %2$s.'),$params['source_name'],$sitename);
47                 $epreamble = sprintf( t('%1$s sent you %2$s.'),'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=$itemlink]' . t('a private message') . '[/url]');
48                 $sitelink = t('Please visit %s to view and/or reply to your private messages.');
49                 $tsitelink = sprintf( $sitelink, $siteurl . '/message/' . $params['item']['id'] );
50                 $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/message/' . $params['item']['id'] . '">' . $sitename . '</a>');
51                 $itemlink = $siteurl . '/message/' . $params['item']['id'];
52         }
53
54         if($params['type'] == NOTIFY_COMMENT) {
55 //              logger("notification: params = " . print_r($params, true), LOGGER_DEBUG);
56
57                 $parent_id = $params['parent'];
58
59                 // Check to see if there was already a tag notify or comment notify for this post.
60                 // If so don't create a second notification
61
62                 $p = null;
63                 $p = q("select id from notify where (type = %d or type = %d or type = %d) and link = '%s' and uid = %d limit 1",
64                         intval(NOTIFY_TAGSELF),
65                         intval(NOTIFY_COMMENT),
66                         intval(NOTIFY_SHARE),
67                         dbesc($params['link']),
68                         intval($params['uid'])
69                 );
70                 if($p and count($p)) {
71                         pop_lang();
72                         return;
73                 }
74
75
76                 // if it's a post figure out who's post it is.
77
78                 $p = null;
79
80                 if($params['otype'] === 'item' && $parent_id) {
81                         $p = q("select * from item where id = %d and uid = %d limit 1",
82                                 intval($parent_id),
83                                 intval($params['uid'])
84                         );
85                 }
86
87                 $item_post_type = item_post_type($p[0]);
88                 //$possess_desc = str_replace('<!item_type!>',$possess_desc);
89
90                 // "a post"
91                 $dest_str = sprintf(t('%1$s commented on [url=%2$s]a %3$s[/url]'),
92                                                                 '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
93                                                                 $itemlink,
94                                                                 $item_post_type);
95
96                 // "George Bull's post"
97                 if($p)
98                         $dest_str = sprintf(t('%1$s commented on [url=%2$s]%3$s\'s %4$s[/url]'),
99                                                 '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
100                                                 $itemlink,
101                                                 $p[0]['author-name'],
102                                                 $item_post_type);
103
104                 // "your post"
105                 if($p[0]['owner-name'] == $p[0]['author-name'] && $p[0]['wall'])
106                         $dest_str = sprintf(t('%1$s commented on [url=%2$s]your %3$s[/url]'),
107                                                                 '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
108                                                                 $itemlink,
109                                                                 $item_post_type);
110
111                 // Some mail softwares relies on subject field for threading.
112                 // So, we cannot have different subjects for notifications of the same thread.
113                 // Before this we have the name of the replier on the subject rendering 
114                 // differents subjects for messages on the same thread.
115
116                 $subject = sprintf( t('[Friendica:Notify] Comment to conversation #%1$d by %2$s'), $parent_id, $params['source_name']);
117                 $preamble = sprintf( t('%s commented on an item/conversation you have been following.'), $params['source_name']); 
118                 $epreamble = $dest_str;
119
120                 $sitelink = t('Please visit %s to view and/or reply to the conversation.');
121                 $tsitelink = sprintf( $sitelink, $siteurl );
122                 $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
123                 $itemlink =  $params['link'];
124         }
125
126         if($params['type'] == NOTIFY_WALL) {
127                 $subject = sprintf( t('[Friendica:Notify] %s posted to your profile wall') , $params['source_name']);
128
129                 $preamble = sprintf( t('%1$s posted to your profile wall at %2$s') , $params['source_name'], $sitename);
130
131                 $epreamble = sprintf( t('%1$s posted to [url=%2$s]your wall[/url]') ,
132                                                                 '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
133                                                                 $params['link']);
134
135                 $sitelink = t('Please visit %s to view and/or reply to the conversation.');
136                 $tsitelink = sprintf( $sitelink, $siteurl );
137                 $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
138                 $itemlink =  $params['link'];
139         }
140
141         if($params['type'] == NOTIFY_TAGSELF) {
142                 $subject =      sprintf( t('[Friendica:Notify] %s tagged you') , $params['source_name']);
143                 $preamble = sprintf( t('%1$s tagged you at %2$s') , $params['source_name'], $sitename);
144                 $epreamble = sprintf( t('%1$s [url=%2$s]tagged you[/url].') ,
145                                                                 '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
146                                                                 $params['link']);
147
148                 $sitelink = t('Please visit %s to view and/or reply to the conversation.');
149                 $tsitelink = sprintf( $sitelink, $siteurl );
150                 $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
151                 $itemlink =  $params['link'];
152         }
153
154         if($params['type'] == NOTIFY_SHARE) {
155                 $subject =      sprintf( t('[Friendica:Notify] %s shared a new post') , $params['source_name']);
156                 $preamble = sprintf( t('%1$s shared a new post at %2$s') , $params['source_name'], $sitename);
157                 $epreamble = sprintf( t('%1$s [url=%2$s]shared a post[/url].') ,
158                                                                 '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
159                                                                 $params['link']);
160
161                 $sitelink = t('Please visit %s to view and/or reply to the conversation.');
162                 $tsitelink = sprintf( $sitelink, $siteurl );
163                 $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
164                 $itemlink =  $params['link'];
165         }
166
167         if($params['type'] == NOTIFY_POKE) {
168
169                 $subject =      sprintf( t('[Friendica:Notify] %1$s poked you') , $params['source_name']);
170                 $preamble = sprintf( t('%1$s poked you at %2$s') , $params['source_name'], $sitename);
171                 $epreamble = sprintf( t('%1$s [url=%2$s]poked you[/url].') , 
172                                                                 '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
173                                                                 $params['link']); 
174
175                 $subject = str_replace('poked', t($params['activity']), $subject);
176                 $preamble = str_replace('poked', t($params['activity']), $preamble);
177                 $epreamble = str_replace('poked', t($params['activity']), $epreamble);
178
179                 $sitelink = t('Please visit %s to view and/or reply to the conversation.');
180                 $tsitelink = sprintf( $sitelink, $siteurl );
181                 $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
182                 $itemlink =  $params['link'];
183         }
184
185         if($params['type'] == NOTIFY_TAGSHARE) {
186                 $subject =      sprintf( t('[Friendica:Notify] %s tagged your post') , $params['source_name']);
187                 $preamble = sprintf( t('%1$s tagged your post at %2$s') , $params['source_name'], $sitename);
188                 $epreamble = sprintf( t('%1$s tagged [url=%2$s]your post[/url]') ,
189                                                                 '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
190                                                                 $itemlink); 
191
192                 $sitelink = t('Please visit %s to view and/or reply to the conversation.');
193                 $tsitelink = sprintf( $sitelink, $siteurl );
194                 $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
195                 $itemlink =  $params['link'];
196         }
197
198         if($params['type'] == NOTIFY_INTRO) {
199                 $subject = sprintf( t('[Friendica:Notify] Introduction received'));
200                 $preamble = sprintf( t('You\'ve received an introduction from \'%1$s\' at %2$s'), $params['source_name'], $sitename); 
201                 $epreamble = sprintf( t('You\'ve received [url=%1$s]an introduction[/url] from %2$s.'),
202                                                                 $itemlink,
203                                                                 '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]'); 
204                 $body = sprintf( t('You may visit their profile at %s'),$params['source_link']);
205
206                 $sitelink = t('Please visit %s to approve or reject the introduction.');
207                 $tsitelink = sprintf( $sitelink, $siteurl );
208                 $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
209                 $itemlink =  $params['link'];
210         }
211
212         if($params['type'] == NOTIFY_SUGGEST) {
213                 $subject = sprintf( t('[Friendica:Notify] Friend suggestion received'));
214                 $preamble = sprintf( t('You\'ve received a friend suggestion from \'%1$s\' at %2$s'), $params['source_name'], $sitename); 
215                 $epreamble = sprintf( t('You\'ve received [url=%1$s]a friend suggestion[/url] for %2$s from %3$s.'),
216                                                                         $itemlink,
217                                                                         '[url=' . $params['item']['url'] . ']' . $params['item']['name'] . '[/url]',
218                                                                         '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]'); 
219                                                                         
220                 $body = t('Name:') . ' ' . $params['item']['name'] . "\n";
221                 $body .= t('Photo:') . ' ' . $params['item']['photo'] . "\n";
222                 $body .= sprintf( t('You may visit their profile at %s'),$params['item']['url']);
223
224                 $sitelink = t('Please visit %s to approve or reject the suggestion.');
225                 $tsitelink = sprintf( $sitelink, $siteurl );
226                 $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
227                 $itemlink =  $params['link'];
228         }
229
230         if($params['type'] == NOTIFY_CONFIRM) {
231         }
232
233         if($params['type'] == NOTIFY_SYSTEM) {
234
235         }
236
237         $h = array(
238                 'params'    => $params, 
239                 'subject'   => $subject,
240                 'preamble'  => $preamble, 
241                 'epreamble' => $epreamble, 
242                 'body'      => $body, 
243                 'sitelink'  => $sitelink,
244                 'tsitelink' => $tsitelink,
245                 'hsitelink' => $hsitelink,
246                 'itemlink'  => $itemlink
247         );
248                 
249         call_hooks('enotify',$h);
250
251         $subject   = $h['subject'];
252         $preamble  = $h['preamble'];
253         $epreamble = $h['epreamble'];
254         $body      = $h['body'];
255         $sitelink  = $h['sitelink'];
256         $tsitelink = $h['tsitelink'];
257         $hsitelink = $h['hsitelink'];
258         $itemlink  = $h['itemlink'];
259
260
261         require_once('include/html2bbcode.php');
262
263         do {
264                 $dups = false;
265                 $hash = random_string();
266         $r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1",
267                         dbesc($hash));
268                 if(count($r))
269                         $dups = true;
270         } while($dups == true);
271
272
273         $datarray = array();
274         $datarray['hash']  = $hash;
275         $datarray['name']  = $params['source_name'];
276         $datarray['url']   = $params['source_link'];
277         $datarray['photo'] = $params['source_photo'];
278         $datarray['date']  = datetime_convert();
279         $datarray['uid']   = $params['uid'];
280         $datarray['link']  = $itemlink;
281         $datarray['parent'] = $parent_id;
282         $datarray['type']  = $params['type'];
283         $datarray['verb']  = $params['verb'];
284         $datarray['otype'] = $params['otype'];
285         $datarray['abort'] = false;
286  
287         call_hooks('enotify_store', $datarray);
288
289         if($datarray['abort']) {
290                 pop_lang();
291                 return;
292         }
293
294         // create notification entry in DB
295
296         $r = q("insert into notify (hash,name,url,photo,date,uid,link,parent,type,verb,otype)
297                 values('%s','%s','%s','%s','%s',%d,'%s',%d,%d,'%s','%s')",
298                 dbesc($datarray['hash']),
299                 dbesc($datarray['name']),
300                 dbesc($datarray['url']),
301                 dbesc($datarray['photo']),
302                 dbesc($datarray['date']),
303                 intval($datarray['uid']),
304                 dbesc($datarray['link']),
305                 intval($datarray['parent']),
306                 intval($datarray['type']),
307                 dbesc($datarray['verb']),
308                 dbesc($datarray['otype'])
309         );
310
311         $r = q("select id from notify where hash = '%s' and uid = %d limit 1",
312                 dbesc($hash),
313                 intval($params['uid'])
314         );
315         if($r)
316                 $notify_id = $r[0]['id'];
317         else {
318                 pop_lang();
319                 return;
320         }
321
322         // we seem to have a lot of duplicate comment notifications due to race conditions, mostly from forums
323         // After we've stored everything, look again to see if there are any duplicates and if so remove them
324
325         $p = null;
326         $p = q("select id from notify where ( type = %d or type = %d ) and link = '%s' and uid = %d order by id",
327                 intval(NOTIFY_TAGSELF),
328                 intval(NOTIFY_COMMENT),
329                 dbesc($params['link']),
330                 intval($params['uid'])
331         );
332         if($p && (count($p) > 1)) {
333                 for ($d = 1; $d < count($p); $d ++) {
334                         q("delete from notify where id = %d",
335                                 intval($p[$d]['id'])
336                         );
337                 }
338
339                 // only continue on if we stored the first one
340
341                 if($notify_id != $p[0]['id']) {
342                         pop_lang();
343                         return;
344                 }
345         }
346
347
348
349
350
351
352
353
354         $itemlink = $a->get_baseurl() . '/notify/view/' . $notify_id;
355         $msg = replace_macros($epreamble,array('$itemlink' => $itemlink));
356         $r = q("update notify set msg = '%s' where id = %d and uid = %d",
357                 dbesc($msg),
358                 intval($notify_id),
359                 intval($params['uid'])
360         );
361
362
363         // send email notification if notification preferences permit
364
365         require_once('include/bbcode.php');
366         if((intval($params['notify_flags']) & intval($params['type'])) || $params['type'] == NOTIFY_SYSTEM) {
367
368                 logger('notification: sending notification email');
369
370                 $id_for_parent = "${params['parent']}@${hostname}";
371
372                 // Is this the first email notification for this parent item and user?
373
374                 $r = q("select `id` from `notify-threads` where `master-parent-item` = %d and `receiver-uid` = %d limit 1",
375                         intval($params['parent']),
376                         intval($params['uid']) );
377
378                 // If so, create the record of it and use a message-id smtp header.
379
380                 if(!$r) {
381                         logger("notify_id:" . intval($notify_id). ", parent: " . intval($params['parent']) . "uid: " .
382 intval($params['uid']), LOGGER_DEBUG);
383                         $r = q("insert into `notify-threads` (`notify-id`, `master-parent-item`, `receiver-uid`, `parent-item`)
384                                 values(%d,%d,%d,%d)",
385                                 intval($notify_id),
386                                 intval($params['parent']),
387                                 intval($params['uid']), 
388                                 0 );
389
390                         $additional_mail_header .= "Message-ID: <${id_for_parent}>\n";
391                         $log_msg = "include/enotify: No previous notification found for this parent:\n" . 
392                                         "  parent: ${params['parent']}\n" . "  uid   : ${params['uid']}\n";
393                         logger($log_msg, LOGGER_DEBUG);
394                 }
395
396                 // If not, just "follow" the thread.
397
398                 else {
399                         $additional_mail_header = "References: <${id_for_parent}>\nIn-Reply-To: <${id_for_parent}>\n";
400                         logger("include/enotify: There's already a notification for this parent:\n" . print_r($r, true), LOGGER_DEBUG);
401                 }
402
403
404
405                 $textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r", "\\n"), "\n",
406                         $body))),ENT_QUOTES,'UTF-8'));
407                 $htmlversion = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"),
408                         "<br />\n",$body))),ENT_QUOTES,'UTF-8');
409
410                 $datarray = array();
411                 $datarray['banner'] = $banner;
412                 $datarray['product'] = $product;
413                 $datarray['preamble'] = $preamble;
414                 $datarray['sitename'] = $sitename;
415                 $datarray['siteurl'] = $siteurl;
416                 $datarray['type'] = $params['type'];
417                 $datarray['parent'] = $params['parent'];
418                 $datarray['source_name'] = $params['source_name'];
419                 $datarray['source_link'] = $params['source_link'];
420                 $datarray['source_photo'] = $params['source_photo'];
421                 $datarray['uid'] = $params['uid'];
422                 $datarray['username'] = $params['to_name'];
423                 $datarray['hsitelink'] = $hsitelink;
424                 $datarray['tsitelink'] = $tsitelink;
425                 $datarray['hitemlink'] = '<a href="' . $itemlink . '">' . $itemlink . '</a>';
426                 $datarray['titemlink'] = $itemlink;
427                 $datarray['thanks'] = $thanks;
428                 $datarray['site_admin'] = $site_admin;
429                 $datarray['title'] = stripslashes($title);
430                 $datarray['htmlversion'] = $htmlversion;
431                 $datarray['textversion'] = $textversion;
432                 $datarray['subject'] = $subject;
433                 $datarray['headers'] = $additional_mail_header;
434
435                 call_hooks('enotify_mail', $datarray);
436
437                 // check whether sending post content in email notifications is allowed
438                 $content_allowed = !get_config('system','enotify_no_content');
439
440                 // load the template for private message notifications
441                 $tpl = get_markup_template('email_notify_html.tpl');
442                 $email_html_body = replace_macros($tpl,array(
443                         '$banner'       => $datarray['banner'],
444                         '$product'      => $datarray['product'],
445                         '$preamble'     => $datarray['preamble'],
446                         '$sitename'     => $datarray['sitename'],
447                         '$siteurl'      => $datarray['siteurl'],
448                         '$source_name'  => $datarray['source_name'],
449                         '$source_link'  => $datarray['source_link'],
450                         '$source_photo' => $datarray['source_photo'],
451                         '$username'     => $datarray['to_name'],
452                         '$hsitelink'    => $datarray['hsitelink'],
453                         '$hitemlink'    => $datarray['hitemlink'],
454                         '$thanks'       => $datarray['thanks'],
455                         '$site_admin'   => $datarray['site_admin'],
456                         '$title'                => $datarray['title'],
457                         '$htmlversion'  => $datarray['htmlversion'],
458                         '$content_allowed'      => $content_allowed,
459                 ));
460                 
461                 // load the template for private message notifications
462                 $tpl = get_markup_template('email_notify_text.tpl');
463                 $email_text_body = replace_macros($tpl,array(
464                         '$banner'       => $datarray['banner'],
465                         '$product'      => $datarray['product'],
466                         '$preamble'     => $datarray['preamble'],
467                         '$sitename'     => $datarray['sitename'],
468                         '$siteurl'      => $datarray['siteurl'],
469                         '$source_name'  => $datarray['source_name'],
470                         '$source_link'  => $datarray['source_link'],
471                         '$source_photo' => $datarray['source_photo'],
472                         '$username'     => $datarray['to_name'],
473                         '$tsitelink'    => $datarray['tsitelink'],
474                         '$titemlink'    => $datarray['titemlink'],
475                         '$thanks'       => $datarray['thanks'],
476                         '$site_admin'   => $datarray['site_admin'],
477                         '$title'                => $datarray['title'],
478                         '$textversion'  => $datarray['textversion'],    
479                         '$content_allowed'      => $content_allowed,
480                 ));
481
482 //              logger('text: ' . $email_text_body);
483
484                 // use the EmailNotification library to send the message
485
486                 enotify::send(array(
487                         'fromName' => $sender_name,
488                         'fromEmail' => $sender_email,
489                         'replyTo' => $sender_email,
490                         'toEmail' => $params['to_email'],
491                         'messageSubject' => $datarray['subject'],
492                         'htmlVersion' => $email_html_body,
493                         'textVersion' => $email_text_body,
494                         'additionalMailHeader' => $datarray['headers'],
495                 ));
496         }
497
498         pop_lang();
499
500 }
501
502 require_once('include/email.php');
503
504 class enotify {
505         /**
506          * Send a multipart/alternative message with Text and HTML versions
507          *
508          * @param fromName                      name of the sender
509          * @param fromEmail                     email fo the sender
510          * @param replyTo                       replyTo address to direct responses
511          * @param toEmail                       destination email address
512          * @param messageSubject        subject of the message
513          * @param htmlVersion           html version of the message
514          * @param textVersion           text only version of the message
515          * @param additionalMailHeader  additions to the smtp mail header
516          */
517         static public function send($params) {
518
519                 $fromName = email_header_encode(html_entity_decode($params['fromName'],ENT_QUOTES,'UTF-8'),'UTF-8'); 
520                 $messageSubject = email_header_encode(html_entity_decode($params['messageSubject'],ENT_QUOTES,'UTF-8'),'UTF-8');
521                 
522                 // generate a mime boundary
523                 $mimeBoundary   =rand(0,9)."-"
524                                 .rand(10000000000,9999999999)."-"
525                                 .rand(10000000000,9999999999)."=:"
526                                 .rand(10000,99999);
527
528                 // generate a multipart/alternative message header
529                 $messageHeader =
530                         $params['additionalMailHeader'] .
531                         "From: $fromName <{$params['fromEmail']}>\n" . 
532                         "Reply-To: $fromName <{$params['replyTo']}>\n" .
533                         "MIME-Version: 1.0\n" .
534                         "Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\"";
535
536                 // assemble the final multipart message body with the text and html types included
537                 $textBody       =       chunk_split(base64_encode($params['textVersion']));
538                 $htmlBody       =       chunk_split(base64_encode($params['htmlVersion']));
539                 $multipartMessageBody =
540                         "--" . $mimeBoundary . "\n" .                                   // plain text section
541                         "Content-Type: text/plain; charset=UTF-8\n" .
542                         "Content-Transfer-Encoding: base64\n\n" .
543                         $textBody . "\n" .
544                         "--" . $mimeBoundary . "\n" .                                   // text/html section
545                         "Content-Type: text/html; charset=UTF-8\n" .
546                         "Content-Transfer-Encoding: base64\n\n" .
547                         $htmlBody . "\n" .
548                         "--" . $mimeBoundary . "--\n";                                  // message ending
549
550                 // send the message
551                 $res = mail(
552                         $params['toEmail'],                                                                             // send to address
553                         $messageSubject,                                                                // subject
554                         $multipartMessageBody,                                                  // message body
555                         $messageHeader                                                                  // message headers
556                 );
557                 logger("notification: enotify::send header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG);
558                 logger("notification: enotify::send returns " . $res, LOGGER_DEBUG);
559         }
560 }
561 ?>