[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/admin/ -> test_email.php (source)

   1  <?php
   2  # MantisBT - A PHP based bugtracking system
   3  
   4  # MantisBT is free software: you can redistribute it and/or modify
   5  # it under the terms of the GNU General Public License as published by
   6  # the Free Software Foundation, either version 2 of the License, or
   7  # (at your option) any later version.
   8  #
   9  # MantisBT is distributed in the hope that it will be useful,
  10  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  # GNU General Public License for more details.
  13  #
  14  # You should have received a copy of the GNU General Public License
  15  # along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * @package MantisBT
  19   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  20   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  21   * @link http://www.mantisbt.org
  22   */
  23  /**
  24   * MantisBT Core API's
  25   */
  26  require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' );
  27  
  28  access_ensure_global_level( config_get_global( 'admin_site_threshold' ) );
  29  
  30  $f_mail_test = gpc_get_bool( 'mail_test' );
  31  
  32  html_page_top();
  33  
  34  ?>
  35  
  36  <a id="email"></a>
  37  <table width="100%" bgcolor="#222222" cellpadding="20" cellspacing="1">
  38  <tr>
  39      <td bgcolor="#f4f4f4">
  40          <span class="title">Testing Email</span>
  41          <p>You can test the ability for MantisBT to send email notifications with this form.  Just click "Send Mail".  If the page takes a very long time to reappear or results in an error then you will need to investigate your php/mail server settings (see PHPMailer related settings in your config_inc.php, if they don't exist, copy from config_defaults_inc.php).  Note that errors can also appear in the server error log.  More help can be found at the <a href="http://www.php.net/manual/en/ref.mail.php">PHP website</a> if you are using the mail() PHPMailer sending mode.</p>
  42          <?php
  43          if( $f_mail_test ) {
  44              echo '<strong>Testing Mail</strong> - ';
  45  
  46              # @@@ thraxisp - workaround to ensure a language is set without authenticating
  47              #  will disappear when this is properly localized
  48              lang_push( 'english' );
  49  
  50              $t_email_data = new EmailData;
  51              $t_email_data->email = config_get_global( 'webmaster_email' );
  52              $t_email_data->subject = 'Testing PHP mail() function';
  53              $t_email_data->body = 'Your PHP mail settings appear to be correctly set.';
  54              $t_email_data->metadata['priority'] = config_get( 'mail_priority' );
  55              $t_email_data->metadata['charset'] = 'utf-8';
  56              $result = email_send( $t_email_data );
  57  
  58              if( !$result ) {
  59                  echo ' PROBLEMS SENDING MAIL TO: ' . config_get_global( 'webmaster_email' ) . '. Please check your php/mail server settings.<br />';
  60              } else {
  61                  echo ' mail() send successful.<br />';
  62              }
  63          }
  64  ?>
  65          <form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']?>#email">
  66          Email Address: <?php echo config_get_global( 'webmaster_email' );?><br />
  67          <input type="submit" value="Send Mail" name="mail_test" />
  68          </form>
  69      </td>
  70  </tr>
  71  </table>
  72  
  73  <?php
  74  
  75  html_page_bottom();


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7