File indexing completed on 2025-01-26 05:25:46
0001 <?php 0002 0003 /** 0004 * Flooer Framework 0005 * 0006 * LICENSE: BSD License (2 Clause) 0007 * 0008 * @category Flooer 0009 * @package Flooer_Utility 0010 * @author Akira Ohgaki <akiraohgaki@gmail.com> 0011 * @copyright Akira Ohgaki 0012 * @license https://opensource.org/licenses/BSD-2-Clause BSD License (2 Clause) 0013 * @link https://github.com/akiraohgaki/flooer 0014 */ 0015 0016 /** 0017 * Usage 0018 * 0019 * $bool = Flooer_Utility_Mail::send($to, $subject, $message, $from); 0020 */ 0021 0022 /** 0023 * Email sending wrapper class 0024 * 0025 * @category Flooer 0026 * @package Flooer_Utility 0027 * @author Akira Ohgaki <akiraohgaki@gmail.com> 0028 */ 0029 class Flooer_Utility_Mail 0030 { 0031 0032 /** 0033 * Send an email 0034 * 0035 * @param string $to 0036 * @param string $subject 0037 * @param string $message 0038 * @param string $from 0039 * @param string $cc 0040 * @param string $bcc 0041 * @return bool 0042 */ 0043 public static function send($to, $subject, $message, $from, $cc = null, $bcc = null) 0044 { 0045 $presetMbLanguage = mb_language(); 0046 mb_language('uni'); 0047 $additionalHeaders = "From: $from\n"; 0048 if ($cc) { 0049 $additionalHeaders .= "Cc: $cc\n"; 0050 } 0051 if ($bcc) { 0052 $additionalHeaders .= "Bcc: $bcc\n"; 0053 } 0054 $bool = mb_send_mail($to, $subject, $message, $additionalHeaders); 0055 if ($presetMbLanguage) { 0056 mb_language($presetMbLanguage); 0057 } 0058 return $bool; 0059 } 0060 0061 }