source: trunk/include/functions_mail.inc.php @ 2629

Last change on this file since 2629 was 2629, checked in by rub, 16 years ago

Fix bad content of NBM mail.

Missing a file.

Sorry, multiple dev on work...

  • Property svn:keywords set to Author Date Id Revision
File size: 21.8 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008      Piwigo Team                  http://piwigo.org |
6// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
7// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
8// +-----------------------------------------------------------------------+
9// | This program is free software; you can redistribute it and/or modify  |
10// | it under the terms of the GNU General Public License as published by  |
11// | the Free Software Foundation                                          |
12// |                                                                       |
13// | This program is distributed in the hope that it will be useful, but   |
14// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
15// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
16// | General Public License for more details.                              |
17// |                                                                       |
18// | You should have received a copy of the GNU General Public License     |
19// | along with this program; if not, write to the Free Software           |
20// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21// | USA.                                                                  |
22// +-----------------------------------------------------------------------+
23
24// +-----------------------------------------------------------------------+
25// |                               functions                               |
26// +-----------------------------------------------------------------------+
27
28
29/**
30 * Encodes a string using Q form if required (RFC2045)
31 * mail headers MUST contain only US-ASCII characters
32 */
33function encode_mime_header($str)
34{
35  $x = preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
36  if ($x==0)
37  {
38    return $str;
39  }
40  // Replace every high ascii, control =, ? and _ characters
41  $str = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
42                  "'='.sprintf('%02X', ord('\\1'))", $str);
43
44  // Replace every spaces to _ (more readable than =20)
45  $str = str_replace(" ", "_", $str);
46
47  global $lang_info;
48  return '=?'.get_pwg_charset().'?Q?'.$str.'?=';
49}
50
51/*
52 * Returns the name of the mail sender :
53 *
54 * @return string
55 */
56function get_mail_sender_name()
57{
58  global $conf;
59
60  return (empty($conf['mail_sender_name']) ? $conf['gallery_title'] : $conf['mail_sender_name']);
61}
62
63/*
64 * Returns an array of mail configuration parameters :
65 *
66 * - mail_options: see $conf['mail_options']
67 * - send_bcc_mail_webmaster: see $conf['send_bcc_mail_webmaster']
68 * - email_webmaster: mail corresponding to $conf['webmaster_id']
69 * - formated_email_webmaster: the name of webmaster is $conf['gallery_title']
70 * - text_footer: Piwigo and version
71 *
72 * @return array
73 */
74function get_mail_configuration()
75{
76  global $conf;
77
78  $conf_mail = array(
79    'mail_options' => $conf['mail_options'],
80    'send_bcc_mail_webmaster' => $conf['send_bcc_mail_webmaster'],
81    'default_email_format' => $conf['default_email_format'],
82    'use_smtp' => !empty($conf['smtp_host']),
83    'smtp_host' => $conf['smtp_host'],
84    'smtp_user' => $conf['smtp_user'],
85    'smtp_password' => $conf['smtp_password']
86    );
87
88  // we have webmaster id among user list, what's his email address ?
89  $conf_mail['email_webmaster'] = get_webmaster_mail_address();
90
91  // name of the webmaster is the title of the gallery
92  $conf_mail['formated_email_webmaster'] =
93    format_email(get_mail_sender_name(), $conf_mail['email_webmaster']);
94
95  $conf_mail['boundary_key'] = generate_key(32);
96
97  return $conf_mail;
98}
99
100/**
101 * Returns an email address with an associated real name
102 *
103 * @param string name
104 * @param string email
105 */
106function format_email($name, $email)
107{
108  // Spring cleaning
109  $cvt_email = trim(preg_replace('#[\n\r]+#s', '', $email));
110  $cvt_name = trim(preg_replace('#[\n\r]+#s', '', $name));
111
112  if ($cvt_name!="")
113  {
114    $cvt_name = encode_mime_header(
115              '"'
116              .addcslashes($cvt_name,'"')
117              .'"');
118    $cvt_name .= ' ';
119  }
120
121  if (strpos($cvt_email, '<') === false)
122  {
123    return $cvt_name.'<'.$cvt_email.'>';
124  }
125  else
126  {
127    return $cvt_name.$cvt_email;
128  }
129}
130
131/**
132 * Returns an email address list with minimal email string
133 *
134 * @param string with email list (email separated by comma)
135 */
136function get_strict_email_list($email_list)
137{
138  $result = array();
139  $list = explode(',', $email_list);
140  foreach ($list as $email)
141  {
142    if (strpos($email, '<') !== false)
143    {
144       $email = preg_replace('/.*<(.*)>.*/i', '$1', $email);
145    }
146    $result[] = trim($email);
147  }
148
149  return implode(',', $result);
150}
151
152/**
153 * Returns an completed array template/theme
154 * completed with get_default_template()
155 *
156 * @params:
157 *   - args: incompleted array of template/theme
158 *       o template: template to use [default get_default_template()]
159 *       o theme: template to use [default get_default_template()]
160 */
161function get_array_template_theme($args = array())
162{
163  global $conf;
164
165  $res = array();
166
167  if (empty($args['template']) or empty($args['theme']))
168  {
169    list($res['template'], $res['theme']) = explode('/', get_default_template());
170  }
171
172  if (!empty($args['template']))
173  {
174    $res['template'] = $args['template'];
175  }
176
177  if (!empty($args['theme']))
178  {
179    $res['theme'] = $args['theme'];
180  }
181
182  return $res;
183}
184
185/**
186 * Return an new mail template
187 *
188 * @params:
189 *   - email_format: mail format
190 *   - args: function params of mail function:
191 *       o template: template to use [default get_default_template()]
192 *       o theme: template to use [default get_default_template()]
193 */
194function & get_mail_template($email_format, $args = array())
195{
196  $args = get_array_template_theme($args);
197
198  $mail_template = new Template(PHPWG_ROOT_PATH.'template/'.$args['template'], $args['theme']);
199  $mail_template->set_template_dir(PHPWG_ROOT_PATH.'template/'.$args['template'].'/mail/'.$email_format);
200  return $mail_template;
201}
202
203/**
204 * Return string email format (html or not)
205 *
206 * @param string format
207 */
208function get_str_email_format($is_html)
209{
210  return ($is_html ? 'text/html' : 'text/plain');
211}
212
213/*
214 * Switch language to param language
215 * All entries are push on language stack
216 *
217 * @param string language
218 */
219function switch_lang_to($language)
220{
221  global $switch_lang, $user, $lang, $lang_info;
222
223  if (count($switch_lang['stack']) == 0)
224  {
225    $prev_language = $user['language'];
226  }
227  else
228  {
229    $prev_language = end($switch_lang['stack']);
230  }
231
232  $switch_lang['stack'][] = $language;
233
234  if ($prev_language != $language)
235  {
236    if (!isset($switch_lang['language'][$prev_language]))
237    {
238      $switch_lang[$prev_language]['lang_info'] = $lang_info;
239      $switch_lang[$prev_language]['lang'] = $lang;
240    }
241
242    if (!isset($switch_lang['language'][$language]))
243    {
244      // Re-Init language arrays
245      $lang_info = array();
246      $lang  = array();
247
248      // language files
249      load_language('common.lang', '', array('language'=>$language) );
250      // No test admin because script is checked admin (user selected no)
251      // Translations are in admin file too
252      load_language('admin.lang', '', array('language'=>$language) );
253      trigger_action('loading_lang');
254      load_language('local.lang', '', array('language'=>$language, 'no_fallback'=>true));
255
256      $switch_lang[$language]['lang_info'] = $lang_info;
257      $switch_lang[$language]['lang'] = $lang;
258    }
259    else
260    {
261      $lang_info = $switch_lang[$language]['lang_info'];
262      $lang = $switch_lang[$language]['lang'];
263    }
264
265    $user['language'] = $language;
266  }
267}
268
269/*
270 * Switch back language pushed with switch_lang_to function
271 *
272 * @param: none
273 */
274function switch_lang_back()
275{
276  global $switch_lang, $user, $lang, $lang_info;
277
278  $last_language = array_pop($switch_lang['stack']);
279
280  if (count($switch_lang['stack']) > 0)
281  {
282    $language = end($switch_lang['stack']);
283  }
284  else
285  {
286    $language = $user['language'];
287  }
288
289  if ($last_language != $language)
290  {
291    if (!isset($switch_lang['language'][$language]))
292    {
293      $lang_info = $switch_lang[$language]['lang_info'];
294      $lang = $switch_lang[$language]['lang'];
295    }
296    $user['language'] = $language;
297  }
298}
299
300/**
301 * Returns email of all administrator
302 *
303 * @return string
304 */
305/*
306 * send en notification email to all administrators
307 * if a administrator is doing action,
308 * he's be removed to email list
309 *
310 * @param:
311 *   - keyargs_subject: mail subject on l10n_args format
312 *   - keyargs_content: mail content on l10n_args format
313 *
314 * @return boolean (Ok or not)
315 */
316function pwg_mail_notification_admins($keyargs_subject, $keyargs_content)
317{
318  // Check arguments
319  if
320    (
321      empty($keyargs_subject) or
322      empty($keyargs_content)
323    )
324  {
325    return false;
326  }
327
328  global $conf, $user;
329  $return = true;
330
331  $admins = array();
332
333  $query = '
334select
335  U.'.$conf['user_fields']['username'].' as username,
336  U.'.$conf['user_fields']['email'].' as mail_address
337from
338  '.USERS_TABLE.' as U,
339  '.USER_INFOS_TABLE.' as I
340where
341  I.user_id =  U.'.$conf['user_fields']['id'].' and
342  I.status in (\'webmaster\',  \'admin\') and
343  I.adviser = \'false\' and
344  '.$conf['user_fields']['email'].' is not null and
345  I.user_id <> '.$user['id'].'
346order by
347  username
348';
349
350  $datas = pwg_query($query);
351  if (!empty($datas))
352  {
353    while ($admin = mysql_fetch_array($datas))
354    {
355      if (!empty($admin['mail_address']))
356      {
357        array_push($admins, format_email($admin['username'], $admin['mail_address']));
358      }
359    }
360  }
361
362  if (count($admins) > 0)
363  {
364    $keyargs_content_admin_info = array
365    (
366      get_l10n_args('Connected user: %s', $user['username']),
367      get_l10n_args('IP: %s', $_SERVER['REMOTE_ADDR']),
368      get_l10n_args('Browser: %s', $_SERVER['HTTP_USER_AGENT'])
369    );
370
371    switch_lang_to(get_default_language());
372
373    $return = pwg_mail
374    (
375      '',
376      array
377      (
378        'Bcc' => $admins,
379        'subject' => '['.$conf['gallery_title'].'] '.l10n_args($keyargs_subject),
380        'content' =>
381           l10n_args($keyargs_content)."\n\n"
382          .l10n_args($keyargs_content_admin_info)."\n",
383        'content_format' => 'text/plain'
384      )
385    ) and $return;
386
387    switch_lang_back();
388  }
389
390  return $return;
391}
392
393/*
394 * send en email to user's group
395 *
396 * @param:
397 *   - group_id: mail are sent to group with this Id
398 *   - email_format: mail format
399 *   - keyargs_subject: mail subject on l10n_args format
400 *   - dirname: short name of directory including template
401 *   - tpl_shortname: short template name without extension
402 *   - assign_vars: array used to assign_vars to mail template
403 *   - language_selected: send mail only to user with this selected language
404 *
405 * @return boolean (Ok or not)
406 */
407function pwg_mail_group(
408  $group_id, $email_format, $keyargs_subject,
409  $tpl_shortname,
410  $assign_vars = array(), $language_selected = '')
411{
412  // Check arguments
413  if
414    (
415      empty($group_id) or
416      empty($email_format) or
417      empty($keyargs_subject) or
418      empty($tpl_shortname)
419    )
420  {
421    return false;
422  }
423
424  global $conf;
425  $return = true;
426
427  $query = '
428SELECT
429  distinct language, template
430FROM
431  '.USER_GROUP_TABLE.' as ug
432  INNER JOIN '.USERS_TABLE.' as u  ON '.$conf['user_fields']['id'].' = ug.user_id
433  INNER JOIN '.USER_INFOS_TABLE.' as ui  ON ui.user_id = ug.user_id
434WHERE
435        '.$conf['user_fields']['email'].' IS NOT NULL
436    AND group_id = '.$group_id;
437
438  if (!empty($language_selected))
439  {
440    $query .= '
441    AND language = \''.$language_selected.'\'';
442  }
443
444    $query .= '
445;';
446
447  $result = pwg_query($query);
448
449  if (mysql_num_rows($result) > 0)
450  {
451    $list = array();
452    while ($row = mysql_fetch_array($result))
453    {
454      $row['template_theme'] = $row['template'];
455      list($row['template'], $row['theme']) = explode('/', $row['template_theme']);
456      $list[] = $row;
457    }
458
459    foreach ($list as $elem)
460    {
461      $query = '
462SELECT
463  u.'.$conf['user_fields']['username'].' as username,
464  u.'.$conf['user_fields']['email'].' as mail_address
465FROM
466  '.USER_GROUP_TABLE.' as ug
467  INNER JOIN '.USERS_TABLE.' as u  ON '.$conf['user_fields']['id'].' = ug.user_id
468  INNER JOIN '.USER_INFOS_TABLE.' as ui  ON ui.user_id = ug.user_id
469WHERE
470        '.$conf['user_fields']['email'].' IS NOT NULL
471    AND group_id = '.$group_id.'
472    AND language = \''.$elem['language'].'\'
473    AND template = \''.$elem['template_theme'].'\'
474;';
475
476      $result = pwg_query($query);
477
478      if (mysql_num_rows($result) > 0)
479      {
480        $Bcc = array();
481        while ($row = mysql_fetch_array($result))
482        {
483          if (!empty($row['mail_address']))
484          {
485            array_push($Bcc, format_email($row['username'], $row['mail_address']));
486          }
487        }
488
489        if (count($Bcc) > 0)
490        {
491          switch_lang_to($elem['language']);
492
493          $mail_template = get_mail_template($email_format, $elem);
494          $mail_template->set_filename($tpl_shortname, $tpl_shortname.'.tpl');
495
496          $mail_template->assign(
497            trigger_event('mail_group_assign_vars', $assign_vars));
498
499          $return = pwg_mail
500          (
501            '',
502            array
503            (
504              'Bcc' => $Bcc,
505              'subject' => l10n_args($keyargs_subject),
506              'email_format' => $email_format,
507              'content' => $mail_template->parse($tpl_shortname, true),
508              'content_format' => $email_format,
509              'template' => $elem['template'],
510              'theme' => $elem['theme']
511            )
512          ) and $return;
513
514          switch_lang_back();
515        }
516      }
517    }
518  }
519
520  return $return;
521}
522
523/*
524 * sends an email, using Piwigo specific informations
525 *
526 * @param:
527 *   - to: receiver(s) of the mail (list separated by comma).
528 *   - args: function params of mail function:
529 *       o from: sender [default value webmaster email]
530 *       o Cc: array of carbon copy receivers of the mail. [default value empty]
531 *       o Bcc: array of blind carbon copy receivers of the mail. [default value empty]
532 *       o subject  [default value 'Piwigo']
533 *       o content: content of mail    [default value '']
534 *       o content_format: format of mail content  [default value 'text/plain']
535 *       o email_format: global mail format  [default value $conf_mail['default_email_format']]
536 *       o template: template to use [default get_default_template()]
537 *       o theme: template to use [default get_default_template()]
538 *
539 * @return boolean (Ok or not)
540 */
541function pwg_mail($to, $args = array())
542{
543  global $conf, $conf_mail, $lang_info, $page;
544
545  if (empty($to) and empty($args['Cc']) and empty($args['Bcc']))
546  {
547    return true;
548  }
549
550  if (!isset($conf_mail))
551  {
552    $conf_mail = get_mail_configuration();
553  }
554
555  if (empty($args['email_format']))
556  {
557    $args['email_format'] = $conf_mail['default_email_format'];
558  }
559
560  // Compute root_path in order have complete path
561  if ($args['email_format'] == 'text/html')
562  {
563    set_make_full_url();
564  }
565
566  if (empty($args['from']))
567  {
568    $args['from'] = $conf_mail['formated_email_webmaster'];
569  }
570  else
571  {
572    $args['from'] = format_email('', $args['from']);
573  }
574
575  if (empty($args['subject']))
576  {
577    $args['subject'] = 'Piwigo';
578  }
579  // Spring cleaning
580  $cvt_subject = trim(preg_replace('#[\n\r]+#s', '', $args['subject']));
581  // Ascii convertion
582  $cvt_subject = encode_mime_header($cvt_subject);
583
584  if (!isset($args['content']))
585  {
586    $args['content'] = '';
587  }
588
589  if (empty($args['content_format']))
590  {
591    $args['content_format'] = 'text/plain';
592  }
593
594  if ($conf_mail['send_bcc_mail_webmaster'])
595  {
596    $args['Bcc'][] = $conf_mail['formated_email_webmaster'];
597  }
598
599  if (($args['content_format'] == 'text/html') and ($args['email_format'] == 'text/plain'))
600  {
601    // Todo find function to convert html text to plain text
602    return false;
603  }
604
605  $args = array_merge($args, get_array_template_theme($args));
606
607  $headers = 'From: '.$args['from']."\n";
608  $headers.= 'Reply-To: '.$args['from']."\n";
609  if (empty($to))
610  {
611    $headers.= 'To: undisclosed-recipients: ;'."\n";
612  }
613  else
614  {
615    $headers.= 'To: '.$to."\n";
616  }
617
618  if (!empty($args['Cc']))
619  {
620    $headers.= 'Cc: '.implode(',', $args['Cc'])."\n";
621  }
622
623  if (!empty($args['Bcc']))
624  {
625    $headers.= 'Bcc: '.implode(',', $args['Bcc'])."\n";
626  }
627
628  $headers.= 'Content-Type: multipart/alternative;'."\n";
629  $headers.= '  boundary="---='.$conf_mail['boundary_key'].'";'."\n";
630  $headers.= '  reply-type=original'."\n";
631  $headers.= 'MIME-Version: 1.0'."\n";
632  $headers.= 'X-Mailer: Piwigo Mailer'."\n";
633
634  $content = '';
635
636  // key compose of indexes witch allow ti cache mail data
637  $cache_key = $args['email_format'].'-'.$lang_info['code'].'-'.$args['template'].'-'.$args['theme'];
638
639  if (!isset($conf_mail[$cache_key]))
640  {
641    if (!isset($mail_template))
642    {
643      $mail_template = get_mail_template($args['email_format']);
644    }
645
646    $mail_template->set_filename('mail_header', 'header.tpl');
647    $mail_template->set_filename('mail_footer', 'footer.tpl');
648
649    $mail_template->assign(
650      array(
651        //Header
652        'BOUNDARY_KEY' => $conf_mail['boundary_key'],
653        'CONTENT_TYPE' => $args['email_format'],
654        'CONTENT_ENCODING' => get_pwg_charset(),
655        'LANG' => $lang_info['code'],
656        'DIR' => $lang_info['direction'],
657
658        // Footer
659        'GALLERY_URL' =>
660          isset($page['gallery_url']) ?
661                $page['gallery_url'] : $conf['gallery_url'],
662        'GALLERY_TITLE' =>
663          isset($page['gallery_title']) ?
664                $page['gallery_title'] : $conf['gallery_title'],
665        'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '',
666        'PHPWG_URL' => PHPWG_URL,
667
668        'TITLE_MAIL' => urlencode(l10n('title_send_mail')),
669        'MAIL' => get_webmaster_mail_address()
670        ));
671
672    if ($args['email_format'] == 'text/html')
673    {
674      if (is_file($mail_template->get_template_dir().'/global-mail-css.tpl'))
675      {
676        $mail_template->set_filename('css', 'global-mail-css.tpl');
677        $mail_template->assign_var_from_handle('GLOBAL_MAIL_CSS', 'css');
678      }
679
680      $root_abs_path = dirname(dirname(__FILE__));
681
682      $file = $root_abs_path.'/template/'.$args['template'].'/theme/'.$args['theme'].'/mail-css.tpl';
683      if (is_file($file))
684      {
685        $mail_template->set_filename('css', $file);
686        $mail_template->assign_var_from_handle('MAIL_CSS', 'css');
687      }
688
689      $file = $root_abs_path.'/template-common/local-mail-css.tpl';
690      if (is_file($file))
691      {
692        $mail_template->set_filename('css', $file);
693        $mail_template->assign_var_from_handle('LOCAL_MAIL_CSS', 'css');
694      }
695    }
696
697    // what are displayed on the header of each mail ?
698    $conf_mail[$cache_key]['header'] =
699      $mail_template->parse('mail_header', true);
700
701    // what are displayed on the footer of each mail ?
702    $conf_mail[$cache_key]['footer'] =
703      $mail_template->parse('mail_footer', true);
704  }
705
706  // Header
707  $content.= $conf_mail[$cache_key]['header'];
708
709  // Content
710  if (($args['content_format'] == 'text/plain') and ($args['email_format'] == 'text/html'))
711  {
712    $content.= '<p>'.
713                nl2br(
714                  preg_replace("/(http:\/\/)([^\s,]*)/i",
715                               "<a href='$1$2'>$1$2</a>",
716                               htmlspecialchars($args['content']))).
717                '</p>';
718  }
719  else
720  {
721    $content.= $args['content'];
722  }
723
724  // Footer
725  $content.= $conf_mail[$cache_key]['footer'];
726
727  // Close boundary
728  $content.= "\n".'-----='.$conf_mail['boundary_key'].'--'."\n";
729
730   // Undo Compute root_path in order have complete path
731  if ($args['email_format'] == 'text/html')
732  {
733    unset_make_full_url();
734  }
735
736  return
737    trigger_event('send_mail',
738      false, /* Result */
739      trigger_event('send_mail_to', get_strict_email_list($to)),
740      trigger_event('send_mail_subject', $cvt_subject),
741      trigger_event('send_mail_content', $content),
742      trigger_event('send_mail_headers', $headers),
743      $args
744    );
745}
746
747/*
748 * pwg sendmail
749 *
750 * @param:
751 *   - result of other sendmail
752 *   - to: Receiver or receiver(s) of the mail.
753 *   - subject  [default value 'Piwigo']
754 *   - content: content of mail
755 *   - headers: headers of mail
756 *
757 * @return boolean (Ok or not)
758 */
759function pwg_send_mail($result, $to, $subject, $content, $headers)
760{
761  if (!$result)
762  {
763    global $conf_mail;
764
765    if ($conf_mail['use_smtp'])
766    {
767      include_once( PHPWG_ROOT_PATH.'include/class_smtp_mail.inc.php' );
768      $smtp_mail = new smtp_mail(
769        $conf_mail['smtp_host'], $conf_mail['smtp_user'], $conf_mail['smtp_password'],
770        $conf_mail['email_webmaster']);
771      return $smtp_mail->mail($to, $subject, $content, $headers);
772    }
773    else
774    {
775      if ($conf_mail['mail_options'])
776      {
777        $options = '-f '.$conf_mail['email_webmaster'];
778        return mail($to, $subject, $content, $headers, $options);
779      }
780      else
781      {
782        return mail($to, $subject, $content, $headers);
783      }
784    }
785  }
786  else
787  {
788    return $result;
789  }
790}
791
792/*Testing block*/
793/*function pwg_send_mail_test($result, $to, $subject, $content, $headers, $args)
794{
795    global $conf, $user, $lang_info;
796    $dir = $conf['local_data_dir'].'/tmp';
797    if ( mkgetdir( $dir,  MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR) )
798    {
799      $filename = $dir.'/mail.'.$user['username'].'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme'];
800      if ($args['content_format'] == 'text/plain')
801      {
802        $filename .= '.txt';
803      }
804      else
805      {
806        $filename .= '.html';
807      }
808      $file = fopen($filename, 'w+');
809      fwrite($file, $to ."\n");
810      fwrite($file, $subject ."\n");
811      fwrite($file, $headers);
812      fwrite($file, $content);
813      fclose($file);
814    }
815    return $result;
816}
817add_event_handler('send_mail', 'pwg_send_mail_test', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 6);*/
818
819
820add_event_handler('send_mail', 'pwg_send_mail', EVENT_HANDLER_PRIORITY_NEUTRAL, 5);
821trigger_action('functions_mail_included');
822
823?>
Note: See TracBrowser for help on using the repository browser.