Version 0.3.5 beta

This commit is contained in:
Stephan Kasdorf
2018-03-14 16:37:09 +01:00
parent f7f7550833
commit c9f29ce086
152 changed files with 14954 additions and 1124 deletions

View File

@@ -1,5 +1,6 @@
# Nibiru
Version 0.1 beta
# Nibiru
### Rapid Prototyping PHP Framework
Version 0.3.5 beta
## Introduction
<div style="word-spacing: 2px; letter-spacing: 0.1px; font-size: 12px; margin-bottom: 15px;">Nibiru is a rapid prototyping framework written in PHP and based on the MVC design pattern. Now one may say that writing <br>
@@ -38,7 +39,7 @@ Engine Implementation.</div>
<li>Twig tempalte eninge tests</li>
<li>Database access functionallity for the db.php Factory</li>
</ul>
<h1>Previous version</h1>
<p>Version 0.2 beta 19.07.2017</p>
<ul>
<li>Dispatcher update now supports actions within Controllers</li>
@@ -54,9 +55,8 @@ Engine Implementation.</div>
<li>Dwoo tempalte eninge tests</li>
<li>Twig tempalte eninge tests</li>
</ul>
<h1>Update</h1>
<p>Version 0.3 beta 04.02.2018</p>
<h1>Previous version</h1>
<h1>Version 0.3 beta 04.02.2018</h1>
<ul>
<li>Improved: The Router now accepts actions, either trough the _action as parameter, or on the URL pattern after the controller name Example: http://youdomain/[controllername]/[actionname]/</li>
<li>It is now possible to load as many navigations on the page as wanted by passing the name to the <br>JsonNavigation::getInstance()->loadJsonNavigationArray('[NAME]'); <br>call in the navigationAction of the Controller</li>
@@ -66,6 +66,15 @@ Engine Implementation.</div>
</ul>
</div>
<h1>Update</h1>
<p>Version 0.3.5 beta 14.03.2018</p>
<ul>
<li>Bugfix on the Router, now the currentPage will be returned correctly.</li>
<li>Update for the database adapter, a detailed instruction on how to use it will be within the soon comming documentation</li>
<li>Improvement of the form elements, those now are able to also swap div layers around a field, as well as correct labeling</li>
<li>Added missing form elements, migration to a Form factory, in order to easy configure and install a form anywhere you like</li>
<li>Minor bugfixing</li>
</ul>
<div style="word-spacing: 2px; letter-spacing: 0.1px; font-size: 15px; margin-bottom: 15px;">The start is done, have success with PHP prototyping, and always remember to have fun!</div>
Author: Stephan Kasdorf<br><br>

View File

@@ -1,40 +0,0 @@
<?php
namespace Nibiru\Model;
use Nibiru\Adapter\Db;
use Nibiru\Pdo;
/**
* Created by PhpStorm.
* User: kasdorf
* Date: 21.11.17
* Time: 11:22
*/
class Users extends Db
{
const TABLE = array(
'table' => 'user',
'field' => array(
'user_id' => 'user_id',
'user_name' => 'user_name',
'user_pass' => 'user_pass',
'user_active' => 'user_active',
'user_date' => 'user_date'
)
);
public function __construct()
{
self::initTable( self::TABLE );
}
public function selectRowsetById($id = false)
{
$id = array(
self::TABLE['field']['user_id'] => $id
);
return Pdo::fetchRowInArrayById(
self::TABLE['table'], $id
);
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace Nibiru\Model;
use Nibiru\Adapter\Db;
use Nibiru\Pdo;
/**
* Created by PhpStorm.
* User: kasdorf
* Date: 21.11.17
* Time: 11:22
*/
class User extends Db
{
const TALBE = array(
'table' => 'user',
'field' => array(
'user_id' => 'user_id',
'user_name' => 'user_name',
'user_pass' => 'user_pass',
'user_email' => 'user_email',
'user_firstname' => 'user_firstname',
'user_login' => 'user_login',
'user_account_active' => 'user_account_active'
)
);
public function __construct()
{
self::initTable( self::TABLE );
}
public function selectRowsetById($id = false)
{
$id = array(
self::TABLE['field']['user_id'] => $id
);
return Pdo::fetchRowInArrayById(
self::TABLE['table'], $id
);
}
/**
* @desc saves user data to the user table in the database
* @param $userdata
*/
public function saveUserDataToTable( $userdata )
{
$insert = array();
foreach ($userdata as $key=>$entry)
{
if(array_key_exists($key, self::TALBE['field']))
{
$insert[$key] = $entry;
}
}
$this->insertArrayIntoTable($insert, 'user_pass');
}
}

View File

@@ -9,8 +9,22 @@ config_dir = "/../../application/view/configs/"
class_file = "core/l/Smarty/Smarty.class.php"
debugbar = false
[EMAIL]
register.smtp = 1
register.smtp[password] = "YOURPASSWORD"
register.smtp[username] = "YOUREMAILUSERNAME"
register.smtp[host] = "YOURSMTP"
register.smtp[port] = "25"
register.from = "YOURFROMMAIL"
register.sender = "YOURSENDER"
register.subject = "YOURSUBJECTLINE"
register.text = "PATHTOYOURHTMLTEMPLATE"
[SETTINGS]
pageurl = "YOURPAGEURLWITHPROTOCOL"
navigation = "navigation.json"
dbmodel = "/../../application/model/"
modul = "/../../application/modul/"
background.img[] = "public/img/nibiru3.jpg"
smarty.css[] = "public/css/v3/roboto.css"
smarty.css[] = "public/css/v3/toolkit-inverse.css"

View File

@@ -38,6 +38,12 @@ abstract class Db implements IDb
}
}
public function loadPasswordByUsername( $user_name = false )
{
$result = Pdo::query("SELECT DES_DECRYPT(".self::TABLE['field']['user_pass'].", '" . Config::getInstance()->getConfig()[View::NIBIRU_SECURITY]["password_hash"] . "') AS ".self::TABLE['field']['user_pass']." FROM user WHERE " . self::TABLE['field']['user_name']. " = '" . $user_name . "';");
return array_shift($result);
}
public function loadTableAsArray()
{
$result = Pdo::fetchTableAsArray( self::getTable()['table'] );
@@ -59,9 +65,21 @@ abstract class Db implements IDb
// TODO: Implement selectDatasetByMinMax() method.
}
public function insertArrayIntoTable($dataset = array())
/**
* @desc inserts an array into the database as on of the fields may be encrypted, but it has to be a varbinary field
* @param array $dataset
* @param bool $encrypted
*/
public function insertArrayIntoTable($dataset = array(), $encrypted = false)
{
// TODO: Implement insertArrayIntoTable() method.
if($encrypted)
{
Pdo::insertArrayIntoTable(self::$table['table'], $dataset, $encrypted);
}
else
{
Pdo::insertArrayIntoTable(self::$table['table'], $dataset);
}
}
public function nextInsertIndex()
@@ -69,4 +87,27 @@ abstract class Db implements IDb
// TODO: Implement nextInsertIndex() method.
}
/**
* @desc updates a row by a given field and field where search value
* @param bool $wherefield
* @param bool $wherevalue
* @param bool $rowfield
* @param bool $rowvalue
*/
public function updateRowByFieldWhere( $wherefield = false, $wherevalue = false, $rowfield = false, $rowvalue = false )
{
Pdo::updateColumnByFieldWhere( self::$table['table'], $rowfield, $rowvalue, $wherefield, $wherevalue );
}
/**
* @desc select a row by the selected fieldset ( field and where value )
* @param array $field
* @return mixed
*/
public function selectRowByFieldWhere( $field = array() )
{
return Pdo::fetchRowInArrayByWhere(self::$table['table'], $field['field'], $field['value']);
}
}

View File

@@ -33,16 +33,25 @@ class Auth extends Controller implements IAuth
return self::$_instance;
}
public function auth( $username, $password )
public function auth( $login, $password )
{
// TODO: Implement auth($username, $password) method.
$this->_setPassword($password);
$this->_setUsername($username);
$this->_setUsername($login);
echo "<pre>";
print_r(pdo::query("SELECT DES_DECRYPT(user_pass, '".Config::getInstance()->getConfig()["SECURITY"]["password_hash"]."') FROM user;"));
echo "</pre>";
die();
if(!array_key_exists('auth', $_SESSION))
{
$user_password = Pdo::query("SELECT DES_DECRYPT(user_pass, '".Config::getInstance()->getConfig()["SECURITY"]["password_hash"]."') AS pass FROM user WHERE user_login = '".$login."';");
if( $user_password["pass"] == $password )
{
$_SESSION['auth']['login'] = $login;
return true;
}
else
{
return false;
}
}
}
/**

View File

@@ -13,7 +13,8 @@ require_once __DIR__ . '/../i/db.php';
class Autoloader
{
const MY_FILE_NAME = "autoloader.php";
const DB_MODEL_FOLDER = "dbmodels";
const DB_MODEL_FOLDER = "dbmodel";
const MODUL_FOLDER = "modul";
private static $_filesInFoler = array();
private static $_instance;

View File

@@ -7,7 +7,8 @@
*/
namespace Nibiru;
use Nibiru\Autoloader\Autoloader;
require_once __DIR__ . '/../c/autoloader.php';
final class Dispatcher
{
@@ -29,6 +30,7 @@ final class Dispatcher
{
Router::getInstance();
Router::getInstance()->route();
Autoloader::getInstance()->runRequireOnce();
require_once __DIR__ . '/../../application/controller/' . Router::getInstance()->tplName() . 'Controller.php';
$class = "Nibiru\\".\Nibiru\Router::getInstance()->tplName()."Controller";
$controller = new $class();

View File

@@ -8,62 +8,31 @@ use Nibiru\Adapter;
* Time: 20:59
*/
class Form implements IForm
class Form extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => '',
self::FORM_METHOD => '',
self::FORM_ACTION => '',
self::FORM_TARGET => ''
self::FORM_NAME => '',
self::FORM_METHOD => '',
self::FORM_ACTION => '',
self::FORM_TARGET => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct($this->_attributes);
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<form action="ACTION" method="METHOD" name="NAME" target="TARGET">' . "\n" . 'FIELDS</form>' . "\n";
$this->_element = '<form action="ACTION" method="METHOD" name="NAME" target="TARGET" ID CLASS>' . "\n" . 'FIELDS</form>' . "\n";
}
}

77
core/c/formattributes.php Executable file
View File

@@ -0,0 +1,77 @@
<?php
namespace Nibiru\Form;
/**
* Created by PhpStorm.
* User: mithril
* Date: 07.02.18
* Time: 21:57
*/
class FormAttributes
{
private $_attributes = array();
protected $_element;
use \Nibiru\Attributes\Form;
public function __construct( $attributes = false )
{
if($attributes)
{
try {
if( is_array( $attributes ) )
{
$this->_attributes = $attributes;
}
else
{
throw new \Exception( self::errorMessage( str_replace('.php', '', basename( __FILE__ )), __LINE__ ) );
}
} catch (\Exception $e)
{
self::exceptionMessage( $e );
}
}
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
protected function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
$this->_element = str_replace(' ID', '', $this->_element);
$this->_element = str_replace(' CLASS', '', $this->_element);
$this->_element = str_replace(' SPEECH', '', $this->_element);
$this->_element = str_replace(' FORM', '', $this->_element);
$this->_element = str_replace(' placeholder="PLACEHOLDER"', '', $this->_element);
$this->_element = str_replace(' required="REQUIRED"', '', $this->_element);
$this->_element = str_replace(' value="VALUE"', '', $this->_element);
$this->_element = str_replace(' ', ' ', $this->_element);
$this->_element = str_replace(' type="TYPE"', '', $this->_element);
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
}

View File

@@ -33,6 +33,20 @@ final class Pdo extends Mysql implements IPdo
return $result;
}
public static function updateColumnByFieldWhere( $tablename = self::PLACE_TABLE_NAME,
$column_name = IMysql::PLACE_COLUMN_NAME,
$parameter_name = IMysql::PLACE_SEARCH_TERM,
$field_name = IMysql::PLACE_FIELD_NAME,
$where_value = IMysql::PLACE_WHERE_VALUE )
{
$statement = parent::getInstance()->getConn();
$query = "UPDATE " . $tablename . " SET " . $column_name . " = :" . $column_name . " WHERE " . $field_name . " = :". $field_name;
$insert = $statement->prepare($query);
$insert->bindParam( ':'.$column_name, $parameter_name );
$insert->bindParam( ':'.$field_name, $where_value );
$insert->execute();
}
public static function fetchRowInArrayById($tablename = self::PLACE_TABLE_NAME, $id = self::NO_ID )
{
$result = array();
@@ -62,15 +76,23 @@ final class Pdo extends Mysql implements IPdo
return $result;
}
/**
* @desc selects the given table row by given parameter and column
* @param string $tablename
* @param string $column_name
* @param string $parameter_name
* @return mixed
*/
public static function fetchRowInArrayByWhere($tablename = IMysql::PLACE_TABLE_NAME,
$column_name = IMysql::PLACE_COLUMN_NAME,
$parameter_name = IMysql::PLACE_SEARCH_TERM)
{
$statement = parent::getInstance()->getConn();
$prepare = $statement->prepare("SELECT * FROM " . $tablename . " WHERE " . $column_name . " = :" . $parameter_name . ";");
$prepare = $statement->prepare("SELECT * FROM " . $tablename . " WHERE " . $column_name . " = :" . $column_name . ";");
$prepare->bindParam(":".$column_name, $parameter_name, \PDO::PARAM_STR);
$prepare->execute();
$rowset = array_shift($prepare->fetchAll());
$r = $prepare->fetchAll();
$rowset = array_shift( $r );
foreach(array_keys($rowset) as $entry)
{
if(is_string($entry))
@@ -94,6 +116,13 @@ final class Pdo extends Mysql implements IPdo
return $result;
}
/**
* @desc will insert the array with fieldnames into the database, if the last parameter is set it should be a string containing the
* fieldname that should be encrypted
* @param string $tablename
* @param string $array_name
* @param bool $encrypted
*/
public static function insertArrayIntoTable( $tablename = IMysql::PLACE_TABLE_NAME, $array_name = IMysql::PLACE_ARRAY_NAME, $encrypted = IMysql::PLACE_DES_ENCRYPT )
{
$statement = parent::getInstance()->getConn();
@@ -125,15 +154,33 @@ final class Pdo extends Mysql implements IPdo
{
if( ++$i === $numItems )
{
$row .= ":" . $field ;
if($field == $encrypted)
{
$row .= "DES_ENCRYPT(:".$encrypted.", :key)";
}
else
{
$row .= ":" . $field ;
}
}
else
{
$row .= ":" . $field . ", ";
if($field == $encrypted)
{
$row .= "DES_ENCRYPT(:".$encrypted.", :key), ";
}
else
{
$row .= ":" . $field . ", ";
}
}
}
$row .= " )";
$query = $statement->prepare('INSERT INTO ' . $tablename . $row);
if($encrypted)
{
$array_name['key'] = Config::getInstance()->getConfig()[View::NIBIRU_SECURITY]["password_hash"];
}
$query->execute( $entry );
}
}
@@ -160,15 +207,33 @@ final class Pdo extends Mysql implements IPdo
{
if( ++$i === $numItems )
{
$row .= ":" . $field ;
if($field == $encrypted)
{
$row .= "DES_ENCRYPT(:".$encrypted.", :key)";
}
else
{
$row .= ":" . $field ;
}
}
else
{
$row .= ":" . $field . ", ";
if($field == $encrypted)
{
$row .= "DES_ENCRYPT(:".$encrypted.", :key), ";
}
else
{
$row .= ":" . $field . ", ";
}
}
}
$row .= " )";
$query = $statement->prepare('INSERT INTO ' . $tablename . $row);
if($encrypted)
{
$array_name['key'] = Config::getInstance()->getConfig()[View::NIBIRU_SECURITY]["password_hash"];
}
$query->execute( $array_name );
}

View File

@@ -17,9 +17,9 @@ class Settings
private static $_instance;
private static $_is_db_connection = false;
protected function __construct()
protected function __construct( )
{
//Constructor
}
public static function getInstance()

38
core/c/typebutton.php Executable file
View File

@@ -0,0 +1,38 @@
<?php
namespace Nibiru\Form;
use Nibiru\Adapter;
/**
* Created by PhpStorm.
* User: Stephan Kasdorf
* Date: 12.02.18
* Time: 19:58
*/
class TypeButton extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_NAME => '',
self::FORM_ATTRIBUTE_TYPE => ''
);
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<button type="TYPE" value="VALUE" ID CLASS>NAME' . "</button>\n";
}
}

View File

@@ -9,61 +9,30 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeCheckbox implements IForm
class TypeCheckbox extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => '',
self::FORM_VALUE => ''
self::FORM_NAME => '',
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* TODO: Impplement the linebreak optional
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="checkbox" name="NAME" value="VALUE">' . 'VALUE<br>' . "\n";
$this->_element = '<input type="checkbox" name="NAME" value="VALUE" ID CLASS>' . 'VALUE<br>' . "\n";
}

View File

@@ -9,59 +9,29 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeColor implements IForm
class TypeColor extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_VALUE => ''
self::FORM_VALUE => '',
self::FORM_NAME => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="color" name="NAME" value="VALUE">' . "\n";
$this->_element = '<input type="color" name="NAME" value="VALUE" ID CLASS>' . "\n";
}

View File

@@ -9,62 +9,29 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeDate implements IForm
class TypeDate extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_VALUE => '',
self::FORM_NAME => ''
self::FORM_VALUE => '',
self::FORM_NAME => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="date" name="NAME" value="VALUE">' . "\n";
$this->_element = '<input type="date" name="NAME" value="VALUE" ID CLASS>' . "\n";
}
}

View File

@@ -9,60 +9,29 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeDatetime implements IForm
class TypeDatetime extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_VALUE => '',
self::FORM_NAME => ''
self::FORM_VALUE => '',
self::FORM_NAME => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="datetime-local" name="NAME" value="VALUE">' . "\n";
$this->_element = '<input type="datetime-local" name="NAME" value="VALUE" ID CLASS>' . "\n";
}

View File

@@ -9,59 +9,30 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeEmail implements IForm
class TypeEmail extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => ''
self::FORM_NAME => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_PLACEHOLDER => '',
self::FORM_ATTRIBUTE_REQUIRED => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="email" name="NAME">' . "\n";
$this->_element = '<input type="email" name="NAME" placeholder="PLACEHOLDER" required="REQUIRED" ID CLASS>' . "\n";
}

View File

@@ -9,60 +9,28 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeFileUpload implements IForm
class TypeFileUpload extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => ''
self::FORM_NAME => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="file" name="NAME">' . "\n";
$this->_element = '<input type="file" name="NAME" ID CLASS>' . "\n";
}

View File

@@ -9,61 +9,29 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeHidden implements IForm
class TypeHidden extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => '',
self::FORM_VALUE => ''
self::FORM_NAME => '',
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="hidden" value="VALUE" name="NAME">' . "\n";
$this->_element = '<input type="hidden" value="VALUE" name="NAME" ID CLASS>' . "\n";
}

View File

@@ -9,60 +9,28 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeImageSubmit implements IForm
class TypeImageSubmit extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_ATTRIBUTE_SRC => ''
self::FORM_ATTRIBUTE_SRC => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="image" src="SRC">' . "\n";
$this->_element = '<input type="image" src="SRC" ID CLASS>' . "\n";
}

37
core/c/typelabel.php Executable file
View File

@@ -0,0 +1,37 @@
<?php
namespace Nibiru\Form;
use Nibiru\Adapter;
/**
* Created by PhpStorm.
* User: mithril
* Date: 07.02.18
* Time: 21:06
*/
class TypeLabel extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_FOR => '',
self::FORM_ATTRIBUTE_FORM => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<label for="FOR" ID CLASS>VALUE</label>' . "\n";
}
}

View File

@@ -9,60 +9,29 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeNumber implements IForm
class TypeNumber extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => '',
self::FORM_VALUE => ''
self::FORM_NAME => '',
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="number" name="NAME" value="VALUE">' . "\n";
$this->_element = '<input type="number" name="NAME" value="VALUE" ID CLASS>' . "\n";
}

View File

@@ -9,59 +9,28 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeOption implements IForm
class TypeOption extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_VALUE => ''
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
self::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<option value="VALUE">VALUE</option>' . "\n";
$this->_element = '<option value="VALUE" ID CLASS>VALUE</option>' . "\n";
}

View File

@@ -9,59 +9,30 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypePassword implements IForm
class TypePassword extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => ''
self::FORM_NAME => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_PLACEHOLDER => '',
self::FORM_ATTRIBUTE_REQUIRED => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="password" name="NAME">' . "\n";
$this->_element = '<input type="password" name="NAME" placeholder="PLACEHOLDER" required="REQUIRED" ID CLASS>' . "\n";
}

View File

@@ -9,61 +9,31 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeRadio implements IForm
class TypeRadio extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => '',
self::FORM_VALUE => ''
self::FORM_NAME => '',
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_ID => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* TODO: Impplement the linebreak optional
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="radio" name="NAME" value="VALUE">' . 'VALUE<br>' . "\n";
$this->_element = '<input type="radio" name="NAME" value="VALUE" ID CLASS>' . 'VALUE<br>' . "\n";
}

View File

@@ -9,60 +9,29 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeRange implements IForm
class TypeRange extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => '',
self::FORM_VALUE => ''
self::FORM_NAME => '',
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_ID => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="range" name="NAME" value="VALUE">' . "\n";
$this->_element = '<input type="range" name="NAME" value="VALUE" ID CLASS>' . "\n";
}

View File

@@ -9,59 +9,28 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeReset implements IForm
class TypeReset extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_VALUE => ''
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_ID => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="reset" value="VALUE">' . "\n";
$this->_element = '<input type="reset" value="VALUE" ID CLASS>' . "\n";
}

View File

@@ -9,59 +9,27 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeSearch implements IForm
class TypeSearch extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_ID => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="search">' . "\n";
$this->_element = '<input type="search" ID CLASS>' . "\n";
}

View File

@@ -9,59 +9,28 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeSelect implements IForm
class TypeSelect extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => ''
self::FORM_NAME => '',
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_ID => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<select name="NAME">' . "\n" . 'OPTIONS' . "\n" . '</select>' . "\n";
$this->_element = '<select name="NAME" ID CLASS>' . "\n" . 'OPTIONS' . "\n" . '</select>' . "\n";
}

View File

@@ -9,61 +9,28 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeSubmit implements IForm
class TypeSubmit extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_VALUE => ''
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="submit" value="VALUE">' . "\n";
$this->_element = '<input type="submit" value="VALUE" ID CLASS>' . "\n";
}
}

View File

@@ -9,60 +9,31 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeTelefon implements IForm
class TypeTelefon extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => '',
self::FORM_VALUE
self::FORM_NAME => '',
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_PLACEHOLDER => '',
self::FORM_ATTRIBUTE_REQUIRED => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="tel" name="NAME" value="VALUE">' . "\n";
$this->_element = '<input type="tel" name="NAME" value="VALUE" placeholder="PLACEHOLDER" required="REQUIRED" CLASS ID>' . "\n";
}

View File

@@ -9,69 +9,32 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeText implements IForm
class TypeText extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_NAME => '',
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_SPEECH => ''
self::FORM_NAME => '',
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_SPEECH => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_PLACEHOLDER => '',
self::FORM_ATTRIBUTE_REQUIRED => ''
);
private $_element;
public function loadElement( $attributes )
{
if(!array_key_exists('speech', $attributes))
{
$attributes['speech'] = '';
}
else
{
$attributes['speech'] = ' x-webkit-speech';
}
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="text" name="NAME" value="VALUE"SPEECH>' . "\n";
$this->_element = '<input type="text" name="NAME" value="VALUE" placeholder="PLACEHOLDER" required="REQUIRED" SPEECH ID CLASS>' . "\n";
}

View File

@@ -9,21 +9,24 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeTextarea implements IForm
class TypeTextarea extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_ATTRIBUTE_COLS => '',
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_ROWS => '',
self::FORM_NAME => ''
self::FORM_ATTRIBUTE_COLS => '',
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_ROWS => '',
self::FORM_NAME => '',
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_PLACEHOLDER => '',
self::FORM_ATTRIBUTE_REQUIRED => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
@@ -35,36 +38,12 @@ class TypeTextarea implements IForm
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<textarea name="NAME" rows="ROWS" cols="COLS">' . "\n" . "VALUE" . "\n" . '</textarea>' . "\n";
$this->_element = '<textarea name="NAME" rows="ROWS" cols="COLS" placeholder="PLACEHOLDER" required="REQUIRED" ID CLASS>' . "VALUE" . '</textarea>' . "\n";
}

View File

@@ -9,59 +9,27 @@ use Nibiru\Adapter;
* Time: 21:42
*/
class TypeUrl implements IForm
class TypeUrl extends FormAttributes implements IForm
{
private $_attributes = array(
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_ID => ''
);
private $_element;
public function loadElement( $attributes )
{
parent::__construct( $this->_attributes );
$this->_setElement();
$this->_setAttributes( $attributes );
$this->_setAttributes( self::loadAttributeValues( $attributes ) );
return $this->getElement();
}
/**
* @return array
*/
protected function getAttributes( )
{
return $this->_attributes;
}
/**
* @param array $attributes
*/
private function _setAttributes( $attributes )
{
foreach( $attributes as $key=>$entry )
{
switch ($key)
{
case array_key_exists($key, $this->_attributes):
$this->_element = str_replace(strtoupper($key), $entry, $this->getElement());
break;
}
}
}
/**
* @return mixed
*/
protected function getElement( )
{
return $this->_element;
}
/**
* @param mixed $element
*/
private function _setElement( )
{
$this->_element = '<input type="url">' . "\n";
$this->_element = '<input type="url" ID CLASS>' . "\n";
}

View File

@@ -12,10 +12,13 @@ class View extends Controller implements IView
{
private static $_instance;
const NIBIRU_SETTINGS = "SETTINGS";
const NIBIRU_SECURITY = "SECURITY";
const NIBIRU_ROUTING = "ROUTING";
const NIBIRU_FILE_END = ".tpl";
const NIBIRU_SETTINGS = "SETTINGS";
const NIBIRU_URL = "pageurl";
const NIBIRU_ERROR = "ERROR";
const NIBIRU_SECURITY = "SECURITY";
const NIBIRU_ROUTING = "ROUTING";
const NIBIRU_EMAIL = "EMAIL";
const NIBIRU_FILE_END = ".tpl";
private static $smarty = array();
private static $engine = array();

View File

@@ -1,9 +1,6 @@
<?php
namespace Nibiru\Factory;
use Nibiru\Autoloader\Autoloader;
require_once __DIR__ . '/../c/autoloader.php';
/**
* Created by PhpStorm.
* User: kasdorf
@@ -27,7 +24,6 @@ class Db
try {
if( $modelName != "" )
{
Autoloader::getInstance()->runRequireOnce();
self::_setModel( $modelName );
return self::getModel();
}

View File

@@ -1,5 +1,6 @@
<?php
namespace Nibiru\Factory;
use Nibiru\Form\TypeButton;
use Nibiru\Form\TypeCheckbox;
use Nibiru\Form\TypeColor;
use Nibiru\Form\TypeDatetime;
@@ -7,6 +8,7 @@ use Nibiru\Form\TypeEmail;
use Nibiru\Form\TypeFileUpload;
use Nibiru\Form\TypeHidden;
use Nibiru\Form\TypeImageSubmit;
use Nibiru\Form\TypeLabel;
use Nibiru\Form\TypeNumber;
use Nibiru\Form\TypeOption;
use Nibiru\Form\TypePassword;
@@ -34,6 +36,7 @@ class Form
private static $element;
private static $form;
private static $option;
private static $div = false;
/**
* @desc is used internaly for assambly only
@@ -60,6 +63,14 @@ class Form
*/
private static function assamble( $element )
{
if( self::getDiv() )
{
if(is_string(self::getDiv()))
{
$element = str_replace('ELEMENT', $element, self::getDiv());
self::setDiv(false);
}
}
self::$form .= $element;
}
@@ -72,7 +83,40 @@ class Form
{
return str_replace( 'FIELDS', self::$form, $form );
}
/**
* @return mixed
*/
protected static function getDiv( )
{
return self::$div;
}
/**
* @param mixed $div
*/
private static function setDiv( $div = false )
{
if($div != false)
{
if( is_array( $div ) )
{
foreach ( $div as $key=>$selector )
{
self::$div = '<div ' . $key . '="' . $selector . '">' . "\n" . 'ELEMENT</div>' . "\n";
}
}
else
{
self::$div = false;
}
}
else
{
self::$div = false;
}
}
/**
* @return mixed
*/
@@ -94,8 +138,12 @@ class Form
* @param $attributes
* @return mixed
*/
public static function addForm( $attributes )
public static function addForm( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new \Nibiru\Form\Form() );
return self::display( self::getElement()->loadElement( $attributes ) );
}
@@ -104,8 +152,12 @@ class Form
* @desc adds an input type Textfield
* @param $attributes
*/
public static function addInputTypeText( $attributes )
public static function addInputTypeText( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeText() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -114,8 +166,12 @@ class Form
* @desc adds an input type Submit
* @param $attributes
*/
public static function addInputTypeSubmit( $attributes )
public static function addInputTypeSubmit( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeSubmit() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -124,8 +180,12 @@ class Form
* @desc adds an input textarea field with the size of the column and the rows
* @param $attributes
*/
public static function addInputTypeTextarea( $attributes )
public static function addInputTypeTextarea( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeTextarea() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -135,8 +195,12 @@ class Form
* more then one
* @param $attributes
*/
public static function addInputTypeRadio( $attributes )
public static function addInputTypeRadio( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeRadio() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -145,8 +209,12 @@ class Form
* @desc adds an input type of a Checkbox button, should be a tick more of one
* @param $attributes
*/
public static function addInputTypeCheckbox( $attributes )
public static function addInputTypeCheckbox( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeCheckbox() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -155,8 +223,12 @@ class Form
* @desc adds a input field for password entry
* @param $attributes
*/
public static function addInputTypePassword( $attributes )
public static function addInputTypePassword( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypePassword() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -165,8 +237,12 @@ class Form
* @desc adds a calendar field with the given date value
* @param $attributes
*/
public static function addInputTypeDate( $attributes )
public static function addInputTypeDate( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeDate() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -175,8 +251,12 @@ class Form
* @desc adds a field for entering the email address
* @param $attributes
*/
public static function addInputTypeEmail( $attributes )
public static function addInputTypeEmail( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeEmail() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -185,8 +265,12 @@ class Form
* @desc adds a field for entering a color-picker field
* @param $attributes
*/
public static function addInputTypeColor( $attributes )
public static function addInputTypeColor( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeColor() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -195,8 +279,12 @@ class Form
* @desc adds a field for entering a date and time field
* @param $attributes
*/
public static function addInputTypeDatetime( $attributes )
public static function addInputTypeDatetime( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeDatetime() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -205,8 +293,12 @@ class Form
* @desc adds a file upload field to the form
* @param $attributes
*/
public static function addTypeFileUpload( $attributes )
public static function addTypeFileUpload( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeFileUpload() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -215,8 +307,12 @@ class Form
* @desc adds a hidden field to the form
* @param $attributes
*/
public static function addTypeHidden( $attributes )
public static function addTypeHidden( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeHidden() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -225,8 +321,12 @@ class Form
* @desc adds an image as the submit button to the form
* @param $attrbutes
*/
public static function addTypeImageSubmit( $attrbutes )
public static function addTypeImageSubmit( $attrbutes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeImageSubmit() );
self::assamble( self::getElement()->loadElement( $attrbutes ) );
}
@@ -235,8 +335,12 @@ class Form
* @desc adds a field for entering a number
* @param $attributes
*/
public static function addTypeNumber( $attributes )
public static function addTypeNumber( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeNumber() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -246,8 +350,12 @@ class Form
* Default range is from 0 to 100, to the form
* @param $attributes
*/
public static function addTypeRange( $attributes )
public static function addTypeRange( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeRange() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -256,8 +364,12 @@ class Form
* @desc adds a reset button (resets all form values to default values), to the form
* @param $attributes
*/
public static function addTypeReset( $attributes )
public static function addTypeReset( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeReset() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -266,8 +378,12 @@ class Form
* @desc adds a text field for entering a search string to the form
* @param $attributes
*/
public static function addTypeSearch( $attributes )
public static function addTypeSearch( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeSearch() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -276,8 +392,12 @@ class Form
* @desc adds a field for entering a telefon number
* @param $attributes
*/
public static function addTypeTelefon( $attributes )
public static function addTypeTelefon( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeTelefon() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -286,8 +406,12 @@ class Form
* @desc adds a field for entering a URL to the form
* @param $attributes
*/
public static function addTypeUrl( $attributes )
public static function addTypeUrl( $attributes, $div = false )
{
if($div)
{
self::setDiv( $div );
}
self::setElement( new TypeUrl() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
@@ -297,13 +421,32 @@ class Form
* an option field has been added
* @param $attributes
*/
public static function addSelect( $attributes )
public static function addSelect( $attributes, $div = false )
{
if($div!=false)
{
self::setDiv( $div );
}
self::setElement( new TypeSelect() );
self::assamble( self::displaySelect( self::getElement()->loadElement( $attributes ) ) );
}
/**
* @desc adds a form element as button to the form
* @param $attributes
* @param bool $div
*/
public static function addTypeButton( $attributes, $div = false )
{
if($div!=false)
{
self::setDiv( $div );
}
self::setElement( new TypeButton() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
/**
* @desc adds an option field to the form, should be used upfront to the select field
* @param $attributes
@@ -314,4 +457,17 @@ class Form
self::assambleOptions( self::getElement()->loadElement( $attributes ) );
}
/**
* @desc adds a label to the form element
* @param $attributes
*/
public static function addTypeLabel( $attributes, $div = false )
{
if($div!=false)
{
self::setDiv( $div );
}
self::setElement( new TypeLabel() );
self::assamble( self::getElement()->loadElement( $attributes ) );
}
}

View File

@@ -36,6 +36,8 @@ require_once __DIR__ . '/f/db.php';
*/
require_once __DIR__ . '/i/form.php';
require_once __DIR__ . '/f/form.php';
require_once __DIR__ . '/t/form.php';
require_once __DIR__ . '/c/formattributes.php';
require_once __DIR__ . '/c/form.php';
require_once __DIR__ . '/c/typetext.php';
require_once __DIR__ . '/c/typepassword.php';
@@ -48,6 +50,7 @@ require_once __DIR__ . '/c/typedatetime.php';
require_once __DIR__ . '/c/typetelefon.php';
require_once __DIR__ . '/c/typesearch.php';
require_once __DIR__ . '/c/typehidden.php';
require_once __DIR__ . '/c/typebutton.php';
require_once __DIR__ . '/c/typeimagesubmit.php';
require_once __DIR__ . '/c/typenumber.php';
require_once __DIR__ . '/c/typereset.php';
@@ -58,13 +61,12 @@ require_once __DIR__ . '/c/typeoption.php';
require_once __DIR__ . '/c/typeselect.php';
require_once __DIR__ . '/c/typerange.php';
require_once __DIR__ . '/c/typeurl.php';
require_once __DIR__ . '/c/typelabel.php';
require_once __DIR__ . '/i/controller.php';
require_once __DIR__ . '/c/controller.php';
require_once __DIR__ . '/i/view.php';
require_once __DIR__ . '/c/view.php';
require_once __DIR__ . '/c/json-navigation.php';
/**
* @desc currently unfinished
*/

View File

@@ -40,6 +40,13 @@ interface IDb
*/
public function insertArrayIntoTable( $dataset = array() );
/**
* @desc selects a row by the fieldname and the given value, should be
* array('fieldname' => 'value')
* @param array $field
* @return mixed
*/
public function selectRowByFieldWhere( $field = array() );
/**
* @desc beacause there is no autoindex this has to be part of every database model
* class, so the next index is always correctly set
@@ -47,6 +54,10 @@ interface IDb
*/
public function nextInsertIndex();
/**
* @desc loads the password from the datbaase for remembering
* @param bool $user_name
* @return mixed
*/
public function loadPasswordByUsername( $user_name = false );
}

View File

@@ -12,23 +12,29 @@ interface IForm
/**
* @desc Constant Form attributes
*/
const FORM_NAME = 'name';
const FORM_VALUE = 'value';
const FORM_METHOD = 'method';
const FORM_METHOD_TYPE = array('post', 'get');
const FORM_ACTION = 'action';
const FORM_TARGET = 'target';
const FORM_TARGET_TYPE = array('_blank', '_self', '_parent', '_top');
const FORM_TYPE_TEXT = 'text';
const FORM_TYPE_SUBMIT = 'submit';
const FORM_TYPE_BUTTON = 'button';
const FORM_ATTRIBUTE_ROWS = 'rows';
const FORM_ATTRIBUTE_COLS = 'cols';
const FORM_ATTRIBUTE_SPEECH = 'speech';
const FORM_ATTRIBUTE_SRC = 'src';
const FORM_ATTRIBUTE_ALT = 'alt';
const FORM_ATTRIBUTE_ID = 'id';
const FORM_NAME = 'name';
const FORM_VALUE = 'value';
const FORM_METHOD = 'method';
const FORM_METHOD_TYPE = array('post', 'get');
const FORM_ACTION = 'action';
const FORM_TARGET = 'target';
const FORM_TARGET_TYPE = array('_blank', '_self', '_parent', '_top');
const FORM_TYPE_TEXT = 'text';
const FORM_TYPE_SUBMIT = 'submit';
const FORM_TYPE_BUTTON = 'button';
const FORM_ATTRIBUTE_ROWS = 'rows';
const FORM_ATTRIBUTE_COLS = 'cols';
const FORM_ATTRIBUTE_SPEECH = 'speech';
const FORM_ATTRIBUTE_SRC = 'src';
const FORM_ATTRIBUTE_ALT = 'alt';
const FORM_ATTRIBUTE_ID = 'id';
const FORM_ATTRIBUTE_CLASS = 'class';
const FORM_ATTRIBUTE_FOR = 'for';
const FORM_ATTRIBUTE_FORM = 'form';
const FORM_ATTRIBUTE_PLACEHOLDER = 'placeholder';
const FORM_ATTRIBUTE_REQUIRED = 'required';
const FORM_ATTRIBUTE_TYPE = 'type';
/**
* @desc loads the current Form element to the form
* @param $element

View File

@@ -1,71 +0,0 @@
<?php
namespace Nibiru;
/**
* Created by PhpStorm.
* User: stephan
* Date: 24.01.17
* Time: 11:16
*/
interface IInput
{
/**
* @desc constant form types for this class
*/
const TYPE_CHECKBOX = "checkbox";
const TYPE_RADIO = "radio";
const TYPE_EMAIL = "email";
const TYPE_TEXT = "text";
const TYPE_HIDDEN = "hidden";
const TYPE_DATE = "date";
const TYPE_IMAGE = "image";
const TYPE_PASSWORD = "password";
const TYPE_WEEK = "week";
const TYPE_TIME = "time";
const TYPE_TEL = "tel";
const TYPE_SUBMIT = "submit";
const TYPE_BUTTON = "button";
const TYPE_URL = "url";
const TYPE_COLOR = "color";
const TYPE_DATETIME_LOCAL = "datetime-local";
/**
* TODO: Implement onClick for javascript form validation
*@desc Build Templates for the input form field
*/
const INPUT = "\t\t\t" . "<input name=\"{name}\" type=\"{type}\" value=\"{value}\" min=\"{min}\" max=\"{max}\">" . "\n";
const INPUT_LABELED = "\t\t\t" . "<label for=\"{name}\">{labelname}</label>"."<input name=\"{name}\" type=\"{type}\" value=\"{value}\" min=\"{min}\" max=\"{max}\">" . "\n";
/**
* @desc set the form fields, they must be passed within an
* array: array(
* 'fieldnames' => array('name', 'name' ...),
* 'fieldtypes' => 'array(text, radio ...)',
* 'min' => array(number, number ...),
* 'max' => array(number, nunber ...)
* );
* @param $fields
* @return mixed
*/
public function setInputFields($fields);
/**
* @desc offer the main types for an input field
* e.g. type="checkbox",
* type="radio",
* type="email",
* type="text",
* type="hidden",
* type="date",
* type="image"
* type="password"
* type="week"
* type="time"
* type="tel"
* type="submit"
* type="button"
* type="url"
* @param (string) $type
* @return (string)
*/
}

View File

@@ -26,6 +26,8 @@ interface IMysql
const PLACE_PRIMARY_KEY = "PRI";
const PLACE_COLUMN_NAME = "NO COLUMN NAME";
const PLACE_SEARCH_TERM = "NO SEARCH PARAMETER";
const PLACE_FIELD_NAME = "NO FIELD NAME";
const PLACE_WHERE_VALUE = "NO WHERE VALUE";
const PLACE_DES_ENCRYPT = false;
}

View File

@@ -1,44 +0,0 @@
<?php
namespace Nibiru;
/**
* Created by PhpStorm.
* User: stephan
* Date: 24.01.17
* Time: 11:16
* TODO: Write the corresponding class for the select dropdown of the form
*/
interface ISelect
{
/**
* @desc set the name for the select box
* @param $selectName
* @return mixed
*/
public static function setSelectName($selectName);
/**
* @desc set the options array in the current form if present
* e.g.: array(
'names' => array('name1', 'name2'),
* 'value' => array('value1', 'value2')
* )
* @param $optionNames
* @return mixed
*/
public static function setOptionNames($optionNames);
/**
* @desc set the select type possible parameter values
* multiple, single
* @param $selectType
* @return mixed
*/
public static function setSelectType($selectType);
/**
* @desc set the size of the select type if it is multiple
* @param $selectTypeSize
* @return mixed
*/
public static function setSelectTypeSize($selectTypeSize);
}

View File

@@ -1,33 +0,0 @@
<?php
namespace Nibiru;
/**
* Created by PhpStorm.
* User: stephan
* Date: 24.01.17
* Time: 11:22
* TODO: Write the class for the textareas
*/
interface ITextarea
{
/**
* @desc set the name of the text area
* @param (string) $textareaName
* @return (string)
*/
public static function setTextareaName($textareaName);
/**
* @desc set the size of the text area
* @param (int) $textareaSize
* @return (int)
*/
public static function setTextareaSize($textareaSize);
/**
* @desc set the textarea form name given by the father class
* e.g.:
* @param (string) $textareaFormname
* @return (string)
*/
public static function setTextareaFormname($textareaFormname);
}

17
core/l/PHPMailer/.gitattributes vendored Executable file
View File

@@ -0,0 +1,17 @@
* text=auto
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.phan export-ignore
/.php_cs export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/changelog.md export-ignore
/composer.json export-ignore
/docs export-ignore
/examples export-ignore
/phpdoc.dist.xml export-ignore
/test export-ignore
/travis.phpunit.xml.dist export-ignore
/UPGRADING.md export-ignore

13
core/l/PHPMailer/.github/ISSUE_TEMPLATE.md vendored Executable file
View File

@@ -0,0 +1,13 @@
Please check these things before submitting your issue:
- [ ] Make sure you're using the latest version of PHPMailer
- [ ] Check that your problem is not dealt with in [the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting), especially if you're having problems connecting to Gmail or GoDaddy
- [ ] Include sufficient code to reproduce your problem
- [ ] If you're having an SMTP issue, include the debug output generated with `SMTPDebug = 2` set
- [ ] If you have a question about how to use PHPMailer (rather than reporting a bug in it), tag a question on Stack Overflow with `phpmailer`, but [**search first**](http://stackoverflow.com/questions/tagged/phpmailer)!
# Problem description
# Code to reproduce
# Debug output

View File

@@ -0,0 +1,6 @@
Before submitting your pull request, check whether your code adheres to PHPMailer
coding standards by running the following command:
`./vendor/bin/php-cs-fixer --diff --dry-run --verbose fix `
And committing eventual changes. It's important that this command uses the specific version of php-cs-fixer configured for PHPMailer, so run `composer install` within the PHPMailer folder to use the exact version it needs.

9
core/l/PHPMailer/.gitignore vendored Executable file
View File

@@ -0,0 +1,9 @@
docs/*
!docs/README.md
test/message.txt
test/testbootstrap.php
build/
vendor/
*.pem
composer.lock
.php_cs.cache

View File

@@ -0,0 +1,41 @@
<?php
/**
* This configuration will be read and overlaid on top of the
* default configuration. Command line arguments will be applied
* after this file is read.
*/
return [
// A list of directories that should be parsed for class and
// method information. After excluding the directories
// defined in exclude_analysis_directory_list, the remaining
// files will be statically analyzed for errors.
//
// Thus, both first-party and third-party code being used by
// your application should be included in this list.
'directory_list' => [
'src',
'vendor',
'examples'
],
// A directory list that defines files that will be excluded
// from static analysis, but whose class and method
// information should be included.
//
// Generally, you'll want to include the directories for
// third-party code (such as "vendor/") in this list.
//
// n.b.: If you'd like to parse but not analyze 3rd
// party code, directories containing that code
// should be added to the `directory_list` as
// to `exclude_analysis_directory_list`.
"exclude_analysis_directory_list" => [
'vendor/'
],
'skip_slow_php_options_warning' => true,
'exclude_file_regex' => '@^vendor/.*/(tests|Tests)/@',
];

31
core/l/PHPMailer/.php_cs Executable file
View File

@@ -0,0 +1,31 @@
<?php
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => false,
'concat_space' => ['spacing' => 'one'],
'heredoc_to_nowdoc' => true,
'method_argument_space' => true,
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
'no_php4_constructor' => true,
'no_short_echo_tag' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'php_unit_fqcn_annotation' => false,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'phpdoc_summary' => false,
'semicolon_after_instruction' => true,
'simplified_null_return' => true
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/test')
)
;

128
core/l/PHPMailer/.scrutinizer.yml Executable file
View File

@@ -0,0 +1,128 @@
build:
environment:
php: '5.6.0'
before_commands:
- "composer install --prefer-source"
tools:
external_code_coverage:
enabled: true
timeout: 300
filter:
excluded_paths:
- 'docs/*'
- 'examples/*'
- 'extras/*'
- 'test/*'
- 'vendor/*'
php_code_coverage:
enabled: false
filter:
excluded_paths:
- 'docs/*'
- 'examples/*'
- 'extras/*'
- 'test/*'
- 'vendor/*'
php_code_sniffer:
enabled: true
config:
standard: PSR2
filter:
excluded_paths:
- 'docs/*'
- 'examples/*'
- 'extras/*'
- 'test/*'
- 'vendor/*'
# Copy/Paste Detector
php_cpd:
enabled: true
excluded_dirs:
- docs
- examples
- extras
- test
- vendor
# PHP CS Fixer (http://http://cs.sensiolabs.org/).
php_cs_fixer:
enabled: true
config:
level: psr2
filter:
excluded_paths:
- 'docs/*'
- 'examples/*'
- 'extras/*'
- 'test/*'
- 'vendor/*'
# Analyzes the size and structure of a PHP project.
php_loc:
enabled: true
excluded_dirs:
- docs
- examples
- extras
- test
- vendor
# PHP Mess Detector (http://phpmd.org).
php_mess_detector:
enabled: true
config:
rulesets:
- codesize
- unusedcode
- naming
- design
naming_rules:
short_variable: { minimum: 2 }
filter:
excluded_paths:
- 'docs/*'
- 'examples/*'
- 'extras/*'
- 'test/*'
- 'vendor/*'
# Analyzes the size and structure of a PHP project.
php_pdepend:
enabled: true
excluded_dirs:
- docs
- examples
- extras
- test
- vendor
# Runs Scrutinizer's PHP Analyzer Tool
# https://scrutinizer-ci.com/docs/tools/php/php-analyzer/config_reference
php_analyzer:
enabled: true
config:
checkstyle:
enabled: true
naming:
enabled: true
property_name: ^[_a-zA-Z][a-zA-Z0-9_]*$ #Allow underscores & caps
method_name: ^(?:[_a-zA-Z]|__)[a-zA-Z0-9_]*$ #Allow underscores & caps
parameter_name: ^[a-z][a-zA-Z0-9_]*$ # Allow underscores
local_variable: ^[a-zA-Z][a-zA-Z0-9_]*$ #Allow underscores & caps
exception_name: ^[a-zA-Z][a-zA-Z0-9]*Exception$
isser_method_name: ^(?:[_a-zA-Z]|__)[a-zA-Z0-9]*$ #Allow underscores & caps
filter:
excluded_paths:
- 'docs/*'
- 'examples/*'
- 'extras/*'
- 'test/*'
- 'vendor/*'
# Security Advisory Checker
sensiolabs_security_checker: true

60
core/l/PHPMailer/.travis.yml Executable file
View File

@@ -0,0 +1,60 @@
language: php
cache:
directories:
- $HOME/.composer/cache
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y -qq postfix
install:
- REMOVE_PACKAGE="friendsofphp/php-cs-fixer"; if [ "$CS_CHECK" = 1 ]; then REMOVE_PACKAGE="phpunit/phpunit"; fi; composer remove --no-update --no-scripts --dev $REMOVE_PACKAGE
- composer remove --no-update --no-scripts --dev phpdocumentor/phpdocumentor
- composer install
- if [ "$CODE_COVERAGE" != 1 ]; then phpenv config-rm xdebug.ini || true; fi
before_script:
- sudo service postfix stop
- smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
- mkdir -p build/logs
- cp test/testbootstrap-dist.php test/testbootstrap.php
- chmod +x test/fakesendmail.sh
- sudo mkdir -p /var/qmail/bin
- sudo cp test/fakesendmail.sh /var/qmail/bin/sendmail
- sudo cp test/fakesendmail.sh /usr/sbin/sendmail
- |
if [[ $TRAVIS_PHP_VERSION = "hhv"* ]]; then
echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' >> /etc/hhvm/php.ini
else
echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > $(php --ini|grep -m 1 "ini files in:"|cut -d ":" -f 2)/sendmail.ini
fi
script: ./vendor/bin/phpunit --configuration ./travis.phpunit.xml.dist
after_script:
- if [ "$CODE_COVERAGE" = 1 ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$CODE_COVERAGE" = 1 ]; then php ocular.phar code-coverage:upload --format=php-clover ../build/logs/clover.xml; fi
stages:
- coding-standard
- test
jobs:
include:
- stage: coding-standard
before_install:
before_script:
script: ./vendor/bin/php-cs-fixer --diff --dry-run --verbose fix
after_script:
php: 5.5
env: CS_CHECK=1
- stage: test
php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1
env: CODE_COVERAGE=1
- php: 7.2
- php: hhvm
dist: trusty

502
core/l/PHPMailer/LICENSE Executable file
View File

@@ -0,0 +1,502 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

217
core/l/PHPMailer/README.md Executable file
View File

@@ -0,0 +1,217 @@
![PHPMailer](https://raw.github.com/PHPMailer/PHPMailer/master/examples/images/phpmailer.png)
# PHPMailer - A full-featured email creation and transfer class for PHP
Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/quality-score.png?s=3758e21d279becdf847a557a56a3ed16dfec9d5d)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)
[![Code Coverage](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/coverage.png?s=3fe6ca5fe8cd2cdf96285756e42932f7ca256962)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)
[![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer) [![Latest Unstable Version](https://poser.pugx.org/phpmailer/phpmailer/v/unstable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer)
## Class Features
- Probably the world's most popular code for sending email from PHP!
- Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more
- Integrated SMTP support - send without a local mail server
- Send emails with multiple To, CC, BCC and Reply-to addresses
- Multipart/alternative emails for mail clients that do not read HTML email
- Add attachments, including inline
- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings
- SMTP authentication with LOGIN, PLAIN, CRAM-MD5 and XOAUTH2 mechanisms over SSL and SMTP+STARTTLS transports
- Validates email addresses automatically
- Protect against header injection attacks
- Error messages in 47 languages!
- DKIM and S/MIME signing support
- Compatible with PHP 5.5 and later
- Namespaced to prevent name clashes
- Much more!
## Why you might need it
Many PHP developers utilize email in their code. The only PHP function that supports this is the `mail()` function. However, it does not provide any assistance for making use of popular features such as HTML-based emails and attachments.
Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules - the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong!
*Please* don't be tempted to do it yourself - if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own - try [SwiftMailer](https://swiftmailer.symfony.com/), [Zend/Mail](https://zendframework.github.io/zend-mail/), [eZcomponents](https://github.com/zetacomponents/Mail) etc.
The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD and OS X platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server.
## License
This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license. Please read LICENSE for information on the
software availability and distribution.
## Installation & loading
PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via composer is the recommended way to install PHPMailer. Just add this line to your `composer.json` file:
```json
"phpmailer/phpmailer": "~6.0"
```
or run
```sh
composer require phpmailer/phpmailer
```
Note that the `vendor` folder and the `vendor/autoload.php` script are generated by composer; they are not part of PHPMailer.
If you want to use the Gmail XOAUTH2 authentication class, you will also need to add a dependency on the `league/oauth2-client` package in your `composer.json`.
Alternatively, if you're not using composer, copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration and load each class file manually:
```php
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'path/to/PHPMailer/src/Exception.php';
require 'path/to/PHPMailer/src/PHPMailer.php';
require 'path/to/PHPMailer/src/SMTP.php';
```
If you're not using the `SMTP` class explicitly (you're probably not), you don't need a `use` line for the SMTP class.
If you don't speak git or just want a tarball, click the 'zip' button on the right of the project page in GitHub, though note that docs and examples are not included in the tarball.
## Legacy versions
PHPMailer 5.2 (which is compatible with PHP 5.0 - 7.0) is no longer being supported for feature updates, and will only be receiving security updates from now on. You will find the latest version of 5.2 in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable), and future versions of 5.2 will be tagged with 5.2.x version numbers, so existing composer configs should remain working. If you're using PHP 5.5 or later, we recommend you make the necessary changes to switch to the 6.0 release.
## Upgrading from 5.2
The biggest changes are that source files are now in the `src/` folder, and PHPMailer now declares the namespace `PHPMailer\PHPMailer`. This has several important effects [read the upgrade guide](https://github.com/PHPMailer/PHPMailer/tree/master/UPGRADING.md) for more details.
### Minimal installation
While installing the entire package manually or with composer is simple, convenient and reliable, you may want to include only vital files in your project. At the very least you will need [src/PHPMailer.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/PHPMailer.php). If you're using SMTP, you'll need [src/SMTP.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/SMTP.php), and if you're using POP-before SMTP, you'll need [src/POP3.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/POP3.php). You can skip the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder if you're not showing errors to users and can make do with English-only errors. If you're using XOAUTH2 you will need [src/OAuth.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/OAuth.php) as well as the composer dependencies for the services you wish to authenticate with. Really, it's much easier to use composer!
## A Simple Example
```php
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
//Load composer's autoloader
require 'vendor/autoload.php';
$mail = new PHPMailer(true); // Passing `true` enables exceptions
try {
//Server settings
$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'user@example.com'; // SMTP username
$mail->Password = 'secret'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
//Recipients
$mail->setFrom('from@example.com', 'Mailer');
$mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient
$mail->addAddress('ellen@example.com'); // Name is optional
$mail->addReplyTo('info@example.com', 'Information');
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');
//Attachments
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
//Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}
```
You'll find plenty more to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder.
That's it. You should now be ready to use PHPMailer!
## Localization
PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find numerous (47 at the time of writing!) translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this:
```php
// To load the French version
$mail->setLanguage('fr', '/optional/path/to/language/directory/');
```
We welcome corrections and new languages - if you're looking for corrections to do, run the [PHPMailerLangTest.php](https://github.com/PHPMailer/PHPMailer/tree/master/test/PHPMailerLangTest.php) script in the tests folder and it will show any missing translations.
## Documentation
Start reading at the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, this should be the first place you look as it's the most frequently updated.
Examples of how to use PHPMailer for common scenarios can be found in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder. If you're looking for a good starting point, we recommend you start with [the Gmail example](https://github.com/PHPMailer/PHPMailer/tree/master/examples/gmail.phps).
Note that in order to reduce PHPMailer's deployed code footprint, the examples are no longer included if you load PHPMailer via composer or via [GitHub's zip file download](https://github.com/PHPMailer/PHPMailer/archive/master.zip), so you'll need to either clone the git repository or use the above links to get to the examples directly.
Complete generated API documentation is [available online](http://phpmailer.github.io/PHPMailer/).
You can generate complete API-level documentation by running `phpdoc` in the top-level folder, and documentation will appear in teh `docs` folder, though you'll need to have [PHPDocumentor](http://www.phpdoc.org) installed. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/tree/master/test/phpmailerTest.php) a good source of how to do various operations such as encryption.
If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](http://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting).
## Tests
There is a PHPUnit test script in the [test](https://github.com/PHPMailer/PHPMailer/tree/master/test/) folder. PHPMailer uses PHPUnit 4.8 - we would use 5.x but we need to run on PHP 5.5.
Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer)
If this isn't passing, is there something you can do to help?
## Security
Please disclose any vulnerabilities found responsibly - report any security problems found to the maintainers privately.
PHPMailer versions prior to 5.2.22 (released January 9th 2017) have a local file disclosure vulnerability, [CVE-2017-5223](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5223). If content passed into `msgHTML()` is sourced from unfiltered user input, relative paths can map to absolute local file paths and added as attachments. Also note that `addAttachment` (just like `file_get_contents`, `passthru`, `unlink`, etc) should not be passed user-sourced params either! Reported by Yongxiang Li of Asiasecurity.
PHPMailer versions prior to 5.2.20 (released December 28th 2016) are vulnerable to [CVE-2016-10045](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10045) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10045-Vuln-Patch-Bypass.html), and patched by Paul Buonopane (@Zenexer).
PHPMailer versions prior to 5.2.18 (released December 2016) are vulnerable to [CVE-2016-10033](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10033) a critical remote code execution vulnerability, responsibly reported by [Dawid Golunski](http://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html).
See [SECURITY](https://github.com/PHPMailer/PHPMailer/tree/master/SECURITY.md) for more detail on security issues.
## Contributing
Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues).
We're particularly interested in fixing edge-cases, expanding test coverage and updating translations.
If you found a mistake in the docs, or want to add something, go ahead and amend the wiki - anyone can edit it.
If you have git clones from prior to the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone:
```sh
git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git
```
Please *don't* use the SourceForge or Google Code projects any more; they are obsolete and no longer maintained.
## Sponsorship
Development time and resources for PHPMailer are provided by [Smartmessages.net](https://info.smartmessages.net/), a powerful email marketing system.
<a href="https://info.smartmessages.net/"><img src="https://www.smartmessages.net/img/smartmessages-logo.svg" width="250" height="28" alt="Smartmessages email marketing"></a>
Other contributions are gladly received, whether in beer 🍺, T-shirts 👕, Amazon wishlist raids, or cold, hard cash 💰. If you'd like to donate to say "thank you" to maintainers or contributors, please contact them through individual profile pages via [the contributors page](https://github.com/PHPMailer/PHPMailer/graphs/contributors).
## Changelog
See [changelog](changelog.md).
## History
- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/).
- Marcus Bointon (coolbru on SF) and Andy Prevost (codeworxtech) took over the project in 2004.
- Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski.
- Marcus created his fork on [GitHub](https://github.com/Synchro/PHPMailer) in 2008.
- Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer in 2013.
- PHPMailer moves to the [PHPMailer organisation](https://github.com/PHPMailer) on GitHub in 2013.
### What's changed since moving from SourceForge?
- Official successor to the SourceForge and Google Code projects.
- Test suite.
- Continuous integration with Travis-CI.
- Composer support.
- Public development.
- Additional languages and language strings.
- CRAM-MD5 authentication support.
- Preserves full repo history of authors, commits and branches from the original SourceForge project.

26
core/l/PHPMailer/SECURITY.md Executable file
View File

@@ -0,0 +1,26 @@
# Security notices relating to PHPMailer
Please disclose any vulnerabilities found responsibly - report any security problems found to the maintainers privately.
PHPMailer versions prior to 5.2.24 (released July 26th 2017) have an XSS vulnerability in one of the code examples, [CVE-2017-11503](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-11503). The `code_generator.phps` example did not filter user input prior to output. This file is distributed with a `.phps` extension, so it it not normally executable unless it is explicitly renamed, so it is safe by default. There was also an undisclosed potential XSS vulnerability in the default exception handler (unused by default). Patches for both issues kindly provided by Patrick Monnerat of the Fedora Project.
PHPMailer versions prior to 5.2.22 (released January 9th 2017) have a local file disclosure vulnerability, [CVE-2017-5223](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5223). If content passed into `msgHTML()` is sourced from unfiltered user input, relative paths can map to absolute local file paths and added as attachments. Also note that `addAttachment` (just like `file_get_contents`, `passthru`, `unlink`, etc) should not be passed user-sourced params either! Reported by Yongxiang Li of Asiasecurity.
PHPMailer versions prior to 5.2.20 (released December 28th 2016) are vulnerable to [CVE-2016-10045](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10045) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10045-Vuln-Patch-Bypass.html), and patched by Paul Buonopane (@Zenexer).
PHPMailer versions prior to 5.2.18 (released December 2016) are vulnerable to [CVE-2016-10033](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10033) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](http://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html).
PHPMailer versions prior to 5.2.14 (released November 2015) are vulnerable to [CVE-2015-8476](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-8476) an SMTP CRLF injection bug permitting arbitrary message sending.
PHPMailer versions prior to 5.2.10 (released May 2015) are vulnerable to [CVE-2008-5619](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-5619), a remote code execution vulnerability in the bundled html2text library. This file was removed in 5.2.10, so if you are using a version prior to that and make use of the html2text function, it's vitally important that you upgrade and remove this file.
PHPMailer versions prior to 2.0.7 and 2.2.1 are vulnerable to [CVE-2012-0796](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-0796), an email header injection attack.
Joomla 1.6.0 uses PHPMailer in an unsafe way, allowing it to reveal local file paths, reported in [CVE-2011-3747](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2011-3747).
PHPMailer didn't sanitise the `$lang_path` parameter in `SetLanguage`. This wasn't a problem in itself, but some apps (PHPClassifieds, ATutor) also failed to sanitise user-provided parameters passed to it, permitting semi-arbitrary local file inclusion, reported in [CVE-2010-4914](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2010-4914), [CVE-2007-2021](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-2021) and [CVE-2006-5734](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2006-5734).
PHPMailer 1.7.2 and earlier contained a possible DDoS vulnerability reported in [CVE-2005-1807](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2005-1807).
PHPMailer 1.7 and earlier (June 2003) have a possible vulnerability in the `SendmailSend` method where shell commands may not be sanitised. Reported in [CVE-2007-3215](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2007-3215).

125
core/l/PHPMailer/UPGRADING.md Executable file
View File

@@ -0,0 +1,125 @@
# Upgrading from PHPMailer 5.2 to 6.0
PHPMailer 6.0 is a major update, breaking backward compatibility.
If you're in doubt about how you should be using PHPMailer 6, take a look at the examples as they have all been updated to work in a PHPMailer 6.0 style.
## PHP Version
PHPMailer 6.0 requires PHP 5.5 or later, and is fully compatible with PHP 7.0. PHPMailer 5.2 supported PHP 5.0 and upwards, so if you need to run on a legacy PHP version, see the [PHPMailer 5.2-stable branch on Github](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable).
## Loading PHPMailer
The single biggest change will be in the way that you load PHPMailer. In earlier versions you may have done this:
```php
require 'PHPMailerAutoload.php';
```
or
```php
require 'class.phpmailer.php';
require 'class.smtp.php';
```
We recommend that you load PHPMailer via composer, using its standard autoloader, which you probably won't need to load if you're using it already, but in case you're not, you will need to do this instead:
```php
require 'vendor/autoload.php';
```
If you're not using composer, you can still load the classes manually, depending on what you're using:
```php
require 'src/PHPMailer.php';
require 'src/SMTP.php';
require 'src/Exception.php';
```
## Namespace
PHPMailer 6 uses a [namespace](http://php.net/manual/en/language.namespaces.rationale.php) of `PHPMailer\PHPMailer`, because it's the PHPMailer project within the PHPMailer organisation. You **must** import (with a `use` statement) classes you're using explicitly into your own namespace, or reference them absolutely in the global namespace - all the examples do this. This means the fully-qualified name of the main PHPMailer class is `PHPMailer\PHPMailer\PHPMailer`, which is a bit of a mouthful, but there's no harm in it! If you are using other PHPMailer classes explicitly (such as `SMTP` or `Exception`), you will need to import them into your namespace too.
For example you might create an instance like this:
```php
<?php
namespace MyProject;
use PHPMailer\PHPMailer\PHPMailer;
require 'vendor/autoload.php';
$mail = new PHPMailer;
...
```
or alternatively, using a fully qualified name:
```php
<?php
namespace MyProject;
require 'vendor/autoload.php';
$mail = new PHPMailer\PHPMailer\PHPMailer;
...
```
Note that `use` statements apply *only* to the file they appear in (they are local aliases), so if an included file contains `use` statements, it will not import the namespaced classes into the file you're including from.
## Namespaced exceptions
PHPMailer now uses its own namespaced `Exception` class, so if you were previously catching exceptions of type `phpmailerException` (or subclasses of that), you will need to update them to use the PHPMailer namespace, and make any existing `Exception` references use the global namespace, i.e. `\Exception`. If your original code was:
```php
try {
...
} catch (phpmailerException $e) {
echo $e->errorMessage();
} catch (Exception $e) {
echo $e->getMessage();
}
```
Convert it to:
```php
use PHPMailer\PHPMailer\Exception;
...
try {
...
} catch (Exception $e) {
echo $e->errorMessage();
} catch (\Exception $e) {
echo $e->getMessage();
}
```
## OAuth2 Support
The OAuth2 implementation has been completely redesigned using the [OAuth2 packages](http://oauth2-client.thephpleague.com) from the [League of of extraordinary packages](http://thephpleague.com), providing support for many more OAuth services, and you'll need to update your code if you were using OAuth in 5.2. See [the examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) and documentation in the [PHPMailer wiki](https://github.com/PHPMailer/PHPMailer/wiki).
## Extras
Additional classes previously bundled in the `Extras` folder (such as htmlfilter and EasyPeasyICS) have been removed - use equivalent packages from [packagist.org](https://packagist.org) instead.
## Other upgrade changes
See the changelog for full details.
* File structure simplified, classes live in the `src/` folder
* Most statically called functions now use the `static` keyword instead of `self`, so it's possible to override static internal functions in subclasses, for example `validateAddress()`
* Complete RFC standardisation on CRLF (`\r\n`) line breaks by default:
* `PHPMailer::$LE` still exists, but all uses of it are changed to `static::$LE` for easier overriding. It may be changed to `\n` automatically when sending via `mail()` on UNIX-like OSs
* `PHPMailer::CRLF` line ending constant removed
* The length of the line break is no longer used in line length calculations
* Similar changes to line break handling in SMTP and POP3 classes
* All elements previously marked as deprecated have been removed:
* `PHPMailer->Version`
* `PHPMailer->ReturnPath`
* `PHPMailer->PluginDir`
* `PHPMailer->encodeQPphp()`
* `SMTP->CRLF`
* `SMTP->Version`
* `SMTP->SMTP_PORT`
* `POP3->CRLF`
* `POP3->Version`
* NTLM authentication has been removed - it never worked anyway!
* `PHPMailer->Workstation`
* `PHPMailer->Realm`
* `SMTP::authenticate` method signature changed
* `parseAddresses()` is now static
* `validateAddress()` is now called statically from `parseAddresses()`
* `idnSupported()` is now static and is called statically from `punyencodeAddress()`
* `PHPMailer->SingleToArray` is now protected

1
core/l/PHPMailer/VERSION Executable file
View File

@@ -0,0 +1 @@
6.0.3

790
core/l/PHPMailer/changelog.md Executable file
View File

@@ -0,0 +1,790 @@
# PHPMailer Change Log
* Add some modern MIME types
* Add Hindi translation (thanks to @dextel2)
## Version 6.0.3 (January 5th 2018)
* Correct DKIM canonicalization of line breaks for header & body - thanks to @themichaelhall
* Make dependence on ext-filter explicit in composer.json
## Version 6.0.2 (November 29th 2017)
* Don't make max line length depend on line break format
* Improve Travis-CI config - thanks to Filippo Tessarotto
* Match SendGrid transaction IDs
* `idnSupported()` now static, as previously documented
* Improve error messages for invalid addresses
* Improve Indonesian translation (thanks to @januridp)
* Improve Esperanto translation (thanks to @dknacht)
* Clean up git export ignore settings for production and zip bundles
* Update license doc
* Updated upgrading docs
* Clarify `addStringEmbeddedImage` docs
* Hide auth credentials in all but lowest level debug output, prevents leakage in bug reports
* Code style cleanup
## Version 6.0.1 (September 14th 2017)
* Use shorter Message-ID headers (with more entropy) to avoid iCloud blackhole bug
* Switch to Symfony code style (though it's not well defined)
* CI builds now apply syntax & code style checks, so make your PRs tidy!
* CI code coverage only applied on latest version of PHP to speed up builds (thanks to @Slamdunk for these CI changes)
* Remove `composer.lock` - it's important that libraries break early; keeping it is for apps
* Rename test scripts to PSR-4 spec
* Make content-id values settable on attachments, not just embedded items
* Add SMTP transaction IDs to callbacks & allow for future expansion
* Expand test coverage
## Version 6.0 (August 28th 2017)
This is a major update that breaks backwards compatibility.
* **Requires PHP 5.5 or later**
* **Uses the `PHPMailer\PHPMailer` namespace**
* File structure simplified and PSR-4 compatible, classes live in the `src/` folder
* The custom autoloader has been removed: [**use composer**](https://getcomposer.org)!
* Classes & Exceptions renamed to make use of the namespace
* Most statically called functions now use the `static` keyword instead of `self`, so it's possible to override static internal functions in subclasses, for example `validateAddress()`
* Complete RFC standardisation on CRLF (`\r\n`) line breaks for SMTP by default:
* `PHPMailer:$LE` defaults to CRLF
* All uses of `PHPMailer::$LE` property converted to use `static::$LE` constant for consistency and ease of overriding
* Similar changes to line break handling in SMTP and POP3 classes.
* Line break format for `mail()` transport is set automatically.
* Warnings emitted for buggy `mail()` in PHP versions 7.0.0 - 7.0.16 and 7.1.0 - 7.1.2; either upgrade or switch to SMTP.
* Extensive reworking of XOAUTH2, adding support for Google, Yahoo and Microsoft providers, thanks to @sherryl4george
* Major cleanup of docs and examples
* All elements previously marked as deprecated have been removed:
* `PHPMailer->Version` (replaced with `VERSION` constant)
* `PHPMailer->ReturnPath`
* `PHPMailer->PluginDir`
* `PHPMailer->encodeQPphp()`
* `SMTP->CRLF` (replaced with `LE` constant)
* `SMTP->Version` (replaced with `VERSION` constant)
* `SMTP->SMTP_PORT` (replaced with `DEFAULT_PORT` constant)
* `POP3->CRLF` (replaced with `LE` constant)
* `POP3->Version` (replaced with `VERSION` constant)
* `POP3->POP3_PORT` (replaced with `DEFAULT_PORT` constant)
* `POP3->POP3_TIMEOUT` (replaced with `DEFAULT_TIMEOUT` constant)
* NTLM authentication has been removed - it never worked anyway!
* `PHPMailer->Workstation`
* `PHPMailer->Realm`
* `SingleTo` functionality is deprecated; this belongs at a higher level - PHPMailer is not a mailing list system.
* `SMTP::authenticate` method signature changed
* `parseAddresses()` is now static
* `validateAddress()` is now called statically from `parseAddresses()`
* `idnSupported()` is now static and is called statically from `punyencodeAddress()`
* `PHPMailer->SingleToArray` is now protected
* `fixEOL()` method removed - it duplicates `PHPMailer::normalizeBreaks()`, so use that instead
* Don't try to use an auth mechanism if it's not supported by the server
* Reorder automatic AUTH mechanism selector to try most secure method first
* `Extras` classes have been removed - use alternative packages from [packagist.org](https://packagist.org) instead
* Better handling of automatic transfer encoding switch in the presence of long lines
* Simplification of address validation - now uses PHP's `FILTER_VALIDATE_EMAIL` pattern by default, retains advanced options
* `Debugoutput` can accept a PSR-3 logger instance
* To reduce code footprint, the examples folder is no longer included in composer deployments or github zip files
* Trap low-level errors in SMTP, reports via debug output
* More reliable folding of message headers
* Inject your own SMTP implementation via `setSMTPInstance()` instead of having to subclass and override `getSMTPInstance()`.
* Make obtaining SMTP transaction ID more reliable
* Better handling of unreliable PHP timeouts
* Made `SMTPDebug = 4` slightly less noisy
## Version 5.2.25 (August 28th 2017)
* Make obtaining SMTP transaction ID more reliable
* Add Bosnian translation
* This is the last official release in the legacy PHPMailer 5.2 series; there may be future security patches (which will be found in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable)), but no further non-security PRs or issues will be accepted. Migrate to PHPMailer 6.0.
## Version 5.2.24 (July 26th 2017)
* **SECURITY** Fix XSS vulnerability in one of the code examples, [CVE-2017-11503](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-11503). The `code_generator.phps` example did not filter user input prior to output. This file is distributed with a `.phps` extension, so it it not normally executable unless it is explicitly renamed, so it is safe by default. There was also an undisclosed potential XSS vulnerability in the default exception handler (unused by default). Patches for both issues kindly provided by Patrick Monnerat of the Fedora Project.
* Handle bare codes (an RFC contravention) in SMTP server responses
* Make message timestamps more dynamic - calculate the date separately for each message
* More thorough checks for reading attachments.
* Throw an exception when trying to send a message with an empty body caused by an internal error.
* Replaced all use of MD5 and SHA1 hash functions with SHA256.
* Now checks for invalid host strings when sending via SMTP.
* Include timestamps in HTML-format debug output
* Improve Turkish, Norwegian, Serbian, Brazilian Portuguese & simplified Chinese translations
* Correction of Serbian ISO language code from `sr` to `rs`
* Fix matching of multiple entries in `Host` to match IPv6 literals without breaking port selection (see #1094, caused by a3b4f6b)
* Better capture and reporting of SMTP connection errors
## Version 5.2.23 (March 15th 2017)
* Improve trapping of TLS errors during connection so that they don't cause warnings, and are reported better in debug output
* Amend test suite so it uses PHPUnit version 4.8, compatible with older versions of PHP, instead of the version supplied by Travis-CI
* This forces pinning of some dev packages to older releases, but should make travis builds more reliable
* Test suite now runs on HHVM, and thus so should PHPMailer in general
* Improve Czech translations
* Add links to CVE-2017-5223 resources
## Version 5.2.22 (January 5th 2017)
* **SECURITY** Fix [CVE-2017-5223](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5223), local file disclosure vulnerability if content passed to `msgHTML()` is sourced from unfiltered user input. Reported by Yongxiang Li of Asiasecurity. The fix for this means that calls to `msgHTML()` without a `$basedir` will not import images with relative URLs, and relative URLs containing `..` will be ignored.
* Add simple contact form example
* Emoji in test content
## Version 5.2.21 (December 28th 2016)
* Fix missed number update in version file - no functional changes
## Version 5.2.20 (December 28th 2016)
* **SECURITY** Critical security update for CVE-2016-10045 please update now! Thanks to [Dawid Golunski](https://legalhackers.com) and Paul Buonopane (@Zenexer).
* Note that this change will break VERP addresses in Sender if you're using mail() - workaround: use SMTP to localhost instead.
## Version 5.2.19 (December 26th 2016)
* Minor cleanup
## Version 5.2.18 (December 24th 2016)
* **SECURITY** Critical security update for CVE-2016-10033 please update now! Thanks to [Dawid Golunski](https://legalhackers.com).
* Add ability to extract the SMTP transaction ID from some common SMTP success messages
* Minor documentation tweaks
## Version 5.2.17 (December 9th 2016)
* This is officially the last feature release of 5.2. Security fixes only from now on; use PHPMailer 6.0!
* Allow DKIM private key to be provided as a string
* Provide mechanism to allow overriding of boundary and message ID creation
* Improve Brazilian Portuguese, Spanish, Swedish, Romanian, and German translations
* PHP 7.1 support for Travis-CI
* Fix some language codes
* Add security notices
* Improve DKIM compatibility in older PHP versions
* Improve trapping and capture of SMTP connection errors
* Improve passthrough of error levels for debug output
* PHPDoc cleanup
## Version 5.2.16 (June 6th 2016)
* Added DKIM example
* Fixed empty additional_parameters problem
* Fixed wrong version number in VERSION file!
* Improve line-length tests
* Use instance settings for SMTP::connect by default
* Use more secure auth mechanisms first
## Version 5.2.15 (May 10th 2016)
* Added ability to inject custom address validators, and set the default validator
* Fix TLS 1.2 compatibility
* Remove some excess line breaks in MIME structure
* Updated Polish, Russian, Brazilian Portuguese, Georgian translations
* More DRY!
* Improve error messages
* Update dependencies
* Add example showing how to handle multiple form file uploads
* Improve SMTP example
* Improve Windows compatibility
* Use consistent names for temp files
* Fix gmail XOAUTH2 scope, thanks to @sherryl4george
* Fix extra line break in getSentMIMEMessage()
* Improve DKIM signing to use SHA-2
## Version 5.2.14 (Nov 1st 2015)
* Allow addresses with IDN (Internationalized Domain Name) in PHP 5.3+, thanks to @fbonzon
* Allow access to POP3 errors
* Make all POP3 private properties and methods protected
* **SECURITY** Fix vulnerability that allowed email addresses with line breaks (valid in RFC5322) to pass to SMTP, permitting message injection at the SMTP level. Mitigated in both the address validator and in the lower-level SMTP class. Thanks to Takeshi Terada.
* Updated Brazilian Portuguese translations (Thanks to @phelipealves)
## Version 5.2.13 (Sep 14th 2015)
* Rename internal oauth class to avoid name clashes
* Improve Estonian translations
## Version 5.2.12 (Sep 1st 2015)
* Fix incorrect composer package dependencies
* Skip existing embedded image `cid`s in `msgHTML`
## Version 5.2.11 (Aug 31st 2015)
* Don't switch to quoted-printable for long lines if already using base64
* Fixed Travis-CI config when run on PHP 7
* Added Google XOAUTH2 authentication mechanism, thanks to @sherryl4george
* Add address parser for RFC822-format addresses
* Update MS Office MIME types
* Don't convert line breaks when using quoted-printable encoding
* Handle MS Exchange returning an invalid empty AUTH-type list in EHLO
* Don't set name or filename properties on MIME parts that don't have one
## Version 5.2.10 (May 4th 2015)
* Add custom header getter
* Use `application/javascript` for .js attachments
* Improve RFC2821 compliance for timelimits, especially for end-of-data
* Add Azerbaijani translations (Thanks to @mirjalal)
* Minor code cleanup for robustness
* Add Indonesian translations (Thanks to @ceceprawiro)
* Avoid `error_log` Debugoutput naming clash
* Add ability to parse server capabilities in response to EHLO (useful for SendGrid etc)
* Amended default values for WordWrap to match RFC
* Remove html2text converter class (has incompatible license)
* Provide new mechanism for injecting html to text converters
* Improve pointers to docs and support in README
* Add example file upload script
* Refactor and major cleanup of EasyPeasyICS, now a lot more usable
* Make set() method simpler and more reliable
* Add Malay translation (Thanks to @nawawi)
* Add Bulgarian translation (Thanks to @mialy)
* Add Armenian translation (Thanks to Hrayr Grigoryan)
* Add Slovenian translation (Thanks to Klemen Tušar)
* More efficient word wrapping
* Add support for S/MIME signing with additional CA certificate (thanks to @IgitBuh)
* Fix incorrect MIME structure when using S/MIME signing and isMail() (#372)
* Improved checks and error messages for missing extensions
* Store and report SMTP errors more consistently
* Add MIME multipart preamble for better Outlook compatibility
* Enable TLS encryption automatically if the server offers it
* Provide detailed errors when individual recipients fail
* Report more errors when connecting
* Add extras classes to composer classmap
* Expose stream_context_create options via new SMTPOptions property
* Automatic encoding switch to quoted-printable if message lines are too long
* Add Korean translation (Thanks to @ChalkPE)
* Provide a pointer to troubleshooting docs on SMTP connection failure
## Version 5.2.9 (Sept 25th 2014)
* **Important: The autoloader is no longer autoloaded by the PHPMailer class**
* Update html2text from https://github.com/mtibben/html2text
* Improve Arabic translations (Thanks to @tarekdj)
* Consistent handling of connection variables in SMTP and POP3
* PHPDoc cleanup
* Update composer to use PHPUnit 4.1
* Pass consistent params to callbacks
* More consistent handling of error states and debug output
* Use property defaults, remove constructors
* Remove unreachable code
* Use older regex validation pattern for troublesome PCRE library versions
* Improve PCRE detection in older PHP versions
* Handle debug output consistently, and always in UTF-8
* Allow user-defined debug output method via a callable
* msgHTML now converts data URIs to embedded images
* SMTP::getLastReply() will now always be populated
* Improved example code in README
* Ensure long filenames in Content-Disposition are encoded correctly
* Simplify SMTP debug output mechanism, clarify levels with constants
* Add SMTP connection check example
* Simplify examples, don't use mysql* functions
## Version 5.2.8 (May 14th 2014)
* Increase timeout to match RFC2821 section 4.5.3.2 and thus not fail greetdelays, fixes #104
* Add timestamps to default debug output
* Add connection events and new level 3 to debug output options
* Chinese language update (Thanks to @binaryoung)
* Allow custom Mailer types (Thanks to @michield)
* Cope with spaces around SMTP host specs
* Fix processing of multiple hosts in connect string
* Added Galician translation (Thanks to @donatorouco)
* Autoloader now prepends
* Docs updates
* Add Latvian translation (Thanks to @eddsstudio)
* Add Belarusian translation (Thanks to @amaksymiuk)
* Make autoloader work better on older PHP versions
* Avoid double-encoding if mbstring is overloading mail()
* Add Portuguese translation (Thanks to @Jonadabe)
* Make quoted-printable encoder respect line ending setting
* Improve Chinese translation (Thanks to @PeterDaveHello)
* Add Georgian translation (Thanks to @akalongman)
* Add Greek translation (Thanks to @lenasterg)
* Fix serverHostname on PHP < 5.3
* Improve performance of SMTP class
* Implement automatic 7bit downgrade
* Add Vietnamese translation (Thanks to @vinades)
* Improve example images, switch to PNG
* Add Croatian translation (Thanks to @hrvoj3e)
* Remove setting the Return-Path and deprecate the Return-path property - it's just wrong!
* Fix language file loading if CWD has changed (@stephandesouza)
* Add HTML5 email validation pattern
* Improve Turkish translations (Thanks to @yasinaydin)
* Improve Romanian translations (Thanks to @aflorea)
* Check php.ini for path to sendmail/qmail before using default
* Improve Farsi translation (Thanks to @MHM5000)
* Don't use quoted-printable encoding for multipart types
* Add Serbian translation (Thanks to ajevremovic at gmail.com)
* Remove useless PHP5 check
* Use SVG for build status badges
* Store MessageDate on creation
* Better default behaviour for validateAddress
## Version 5.2.7 (September 12th 2013)
* Add Ukrainian translation from @Krezalis
* Support for do_verp
* Fix bug in CRAM-MD5 AUTH
* Propagate Debugoutput option to SMTP class (@Reblutus)
* Determine MIME type of attachments automatically
* Add cross-platform, multibyte-safe pathinfo replacement (with tests) and use it
* Add a new 'html' Debugoutput type
* Clean up SMTP debug output, remove embedded HTML
* Some small changes in header formatting to improve IETF msglint test results
* Update test_script to use some recently changed features, rename to code_generator
* Generated code actually works!
* Update SyntaxHighlighter
* Major overhaul and cleanup of example code
* New PHPMailer graphic
* msgHTML now uses RFC2392-compliant content ids
* Add line break normalization function and use it in msgHTML
* Don't set unnecessary reply-to addresses
* Make fakesendmail.sh a bit cleaner and safer
* Set a content-transfer-encoding on multiparts (fixes msglint error)
* Fix cid generation in msgHTML (Thanks to @digitalthought)
* Fix handling of multiple SMTP servers (Thanks to @NanoCaiordo)
* SMTP->connect() now supports stream context options (Thanks to @stanislavdavid)
* Add support for iCal event alternatives (Thanks to @reblutus)
* Update to Polish language file (Thanks to Krzysztof Kowalewski)
* Update to Norwegian language file (Thanks to @datagutten)
* Update to Hungarian language file (Thanks to @dominicus-75)
* Add Persian/Farsi translation from @jaii
* Make SMTPDebug property type match type in SMTP class
* Add unit tests for DKIM
* Major refactor of SMTP class
* Reformat to PSR-2 coding standard
* Introduce autoloader
* Allow overriding of SMTP class
* Overhaul of PHPDocs
* Fix broken Q-encoding
* Czech language update (Thanks to @nemelu)
* Removal of excess blank lines in messages
* Added fake POP server and unit tests for POP-before-SMTP
## Version 5.2.6 (April 11th 2013)
* Reflect move to PHPMailer GitHub organisation at https://github.com/PHPMailer/PHPMailer
* Fix unbumped version numbers
* Update packagist.org with new location
* Clean up Changelog
## Version 5.2.5 (April 6th 2013)
* First official release after move from Google Code
* Fixes for qmail when sending via mail()
* Merge in changes from Google code 5.2.4 release
* Minor coding standards cleanup in SMTP class
* Improved unit tests, now tests S/MIME signing
* Travis-CI support on GitHub, runs tests with fake SMTP server
## Version 5.2.4 (February 19, 2013)
* Fix tag and version bug.
* un-deprecate isSMTP(), isMail(), IsSendmail() and isQmail().
* Numerous translation updates
## Version 5.2.3 (February 8, 2013)
* Fix issue with older PCREs and ValidateAddress() (Bugz: 124)
* Add CRAM-MD5 authentication, thanks to Elijah madden, https://github.com/okonomiyaki3000
* Replacement of obsolete Quoted-Printable encoder with a much better implementation
* Composer package definition
* New language added: Hebrew
## Version 5.2.2 (December 3, 2012)
* Some fixes and syncs from https://github.com/Synchro/PHPMailer
* Add Slovak translation, thanks to Michal Tinka
## Version 5.2.2-rc2 (November 6, 2012)
* Fix SMTP server rotation (Bugz: 118)
* Allow override of autogen'ed 'Date' header (for Drupal's
og_mailinglist module)
* No whitespace after '-f' option (Bugz: 116)
* Work around potential warning (Bugz: 114)
## Version 5.2.2-rc1 (September 28, 2012)
* Header encoding works with long lines (Bugz: 93)
* Turkish language update (Bugz: 94)
* undefined $pattern in EncodeQ bug squashed (Bugz: 98)
* use of mail() in safe_mode now works (Bugz: 96)
* ValidateAddress() now 'public static' so people can override the
default and use their own validation scheme.
* ValidateAddress() no longer uses broken FILTER_VALIDATE_EMAIL
* Added in AUTH PLAIN SMTP authentication
## Version 5.2.2-beta2 (August 17, 2012)
* Fixed Postfix VERP support (Bugz: 92)
* Allow action_function callbacks to pass/use
the From address (passed as final param)
* Prevent inf look for get_lines() (Bugz: 77)
* New public var ($UseSendmailOptions). Only pass sendmail()
options iff we really are using sendmail or something sendmail
compatible. (Bugz: 75)
* default setting for LE returned to "\n" due to popular demand.
## Version 5.2.2-beta1 (July 13, 2012)
* Expose PreSend() and PostSend() as public methods to allow
for more control if serializing message sending.
* GetSentMIMEMessage() only constructs the message copy when
needed. Save memory.
* Only pass params to mail() if the underlying MTA is
"sendmail" (as defined as "having the string sendmail
in its pathname") [#69]
* Attachments now work with Amazon SES and others [Bugz#70]
* Debug output now sent to stdout (via echo) or error_log [Bugz#5]
* New var: Debugoutput (for above) [Bugz#5]
* SMTP reads now Timeout aware (new var: Timeout=15) [Bugz#71]
* SMTP reads now can have a Timelimit associated with them
(new var: Timelimit=30)[Bugz#71]
* Fix quoting issue associated with charsets
* default setting for LE is now RFC compliant: "\r\n"
* Return-Path can now be user defined (new var: ReturnPath)
(the default is "" which implies no change from previous
behavior, which was to use either From or Sender) [Bugz#46]
* X-Mailer header can now be disabled (by setting to a
whitespace string, eg " ") [Bugz#66]
* Bugz closed: #68, #60, #42, #43, #59, #55, #66, #48, #49,
#52, #31, #41, #5. #70, #69
## Version 5.2.1 (January 16, 2012)
* Closed several bugs #5
* Performance improvements
* MsgHTML() now returns the message as required.
* New method: GetSentMIMEMessage() (returns full copy of sent message)
## Version 5.2 (July 19, 2011)
* protected MIME body and header
* better DKIM DNS Resource Record support
* better aly handling
* htmlfilter class added to extras
* moved to Apache Extras
## Version 5.1 (October 20, 2009)
* fixed filename issue with AddStringAttachment (thanks to Tony)
* fixed "SingleTo" property, now works with Senmail, Qmail, and SMTP in
addition to PHP mail()
* added DKIM digital signing functionality, new properties:
- DKIM_domain (sets the domain name)
- DKIM_private (holds DKIM private key)
- DKIM_passphrase (holds your DKIM passphrase)
- DKIM_selector (holds the DKIM "selector")
- DKIM_identity (holds the identifying email address)
* added callback function support
- callback function parameters include:
result, to, cc, bcc, subject and body
- see the test/test_callback.php file for usage.
* added "auto" identity functionality
- can automatically add:
- Return-path (if Sender not set)
- Reply-To (if ReplyTo not set)
- can be disabled:
- $mail->SetFrom('yourname@yourdomain.com','First Last',false);
- or by adding the $mail->Sender and/or $mail->ReplyTo properties
Note: "auto" identity added to help with emails ending up in spam or junk boxes because of missing headers
## Version 5.0.2 (May 24, 2009)
* Fix for missing attachments when inline graphics are present
* Fix for missing Cc in header when using SMTP (mail was sent,
but not displayed in header -- Cc receiver only saw email To:
line and no Cc line, but did get the email (To receiver
saw same)
## Version 5.0.1 (April 05, 2009)
* Temporary fix for missing attachments
## Version 5.0.0 (April 02, 2009)
With the release of this version, we are initiating a new version numbering
system to differentiate from the PHP4 version of PHPMailer.
Most notable in this release is fully object oriented code.
### class.smtp.php:
* Refactored class.smtp.php to support new exception handling
* code size reduced from 29.2 Kb to 25.6 Kb
* Removed unnecessary functions from class.smtp.php:
- public function Expand($name) {
- public function Help($keyword="") {
- public function Noop() {
- public function Send($from) {
- public function SendOrMail($from) {
- public function Verify($name) {
### class.phpmailer.php:
* Refactored class.phpmailer.php with new exception handling
* Changed processing functionality of Sendmail and Qmail so they cannot be
inadvertently used
* removed getFile() function, just became a simple wrapper for
file_get_contents()
* added check for PHP version (will gracefully exit if not at least PHP 5.0)
* enhanced code to check if an attachment source is the same as an embedded or
inline graphic source to eliminate duplicate attachments
### New /test_script
We have written a test script you can use to test the script as part of your
installation. Once you press submit, the test script will send a multi-mime
email with either the message you type in or an HTML email with an inline
graphic. Two attachments are included in the email (one of the attachments
is also the inline graphic so you can see that only one copy of the graphic
is sent in the email). The test script will also display the functional
script that you can copy/paste to your editor to duplicate the functionality.
### New examples
All new examples in both basic and advanced modes. Advanced examples show
Exception handling.
### PHPDocumentator (phpdocs) documentation for PHPMailer version 5.0.0
All new documentation
## Version 2.3 (November 06, 2008)
* added Arabic language (many thanks to Bahjat Al Mostafa)
* removed English language from language files and made it a default within
class.phpmailer.php - if no language is found, it will default to use
the english language translation
* fixed public/private declarations
* corrected line 1728, $basedir to $directory
* added $sign_cert_file to avoid improper duplicate use of $sign_key_file
* corrected $this->Hello on line 612 to $this->Helo
* changed default of $LE to "\r\n" to comply with RFC 2822. Can be set by the user
if default is not acceptable
* removed trim() from return results in EncodeQP
* /test and three files it contained are removed from version 2.3
* fixed phpunit.php for compliance with PHP5
* changed $this->AltBody = $textMsg; to $this->AltBody = html_entity_decode($textMsg);
* We have removed the /phpdoc from the downloads. All documentation is now on
the http://phpmailer.codeworxtech.com website.
## Version 2.2.1 () July 19 2008
* fixed line 1092 in class.smtp.php (my apologies, error on my part)
## Version 2.2 () July 15 2008
* Fixed redirect issue (display of UTF-8 in thank you redirect)
* fixed error in getResponse function declaration (class.pop3.php)
* PHPMailer now PHP6 compliant
* fixed line 1092 in class.smtp.php (endless loop from missing = sign)
## Version 2.1 (Wed, June 04 2008)
NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS. IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE APPRECIATED.
* added S/MIME functionality (ability to digitally sign emails)
BIG THANKS TO "sergiocambra" for posting this patch back in November 2007.
The "Signed Emails" functionality adds the Sign method to pass the private key
filename and the password to read it, and then email will be sent with
content-type multipart/signed and with the digital signature attached.
* fully compatible with E_STRICT error level
- Please note:
In about half the test environments this development version was subjected
to, an error was thrown for the date() functions used (line 1565 and 1569).
This is NOT a PHPMailer error, it is the result of an incorrectly configured
PHP5 installation. The fix is to modify your 'php.ini' file and include the
date.timezone = Etc/UTC (or your own zone)
directive, to your own server timezone
- If you do get this error, and are unable to access your php.ini file:
In your PHP script, add
`date_default_timezone_set('Etc/UTC');`
- do not try to use
`$myVar = date_default_timezone_get();`
as a test, it will throw an error.
* added ability to define path (mainly for embedded images)
function `MsgHTML($message,$basedir='')` ... where:
`$basedir` is the fully qualified path
* fixed `MsgHTML()` function:
- Embedded Images where images are specified by `<protocol>://` will not be altered or embedded
* fixed the return value of SMTP exit code ( pclose )
* addressed issue of multibyte characters in subject line and truncating
* added ability to have user specified Message ID
(default is still that PHPMailer create a unique Message ID)
* corrected unidentified message type to 'application/octet-stream'
* fixed chunk_split() multibyte issue (thanks to Colin Brown, et al).
* added check for added attachments
* enhanced conversion of HTML to text in MsgHTML (thanks to "brunny")
## Version 2.1.0beta2 (Sun, Dec 02 2007)
* implemented updated EncodeQP (thanks to coolbru, aka Marcus Bointon)
* finished all testing, all known bugs corrected, enhancements tested
Note: will NOT work with PHP4.
Please note, this is BETA software **DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS; INTENDED STRICTLY FOR TESTING**
## Version 2.1.0beta1
Please note, this is BETA software
** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS
INTENDED STRICTLY FOR TESTING
## Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release
* implements new property to control VERP in class.smtp.php
example (requires instantiating class.smtp.php):
$mail->do_verp = true;
* POP-before-SMTP functionality included, thanks to Richard Davey
(see class.pop3.php & pop3_before_smtp_test.php for examples)
* included example showing how to use PHPMailer with GMAIL
* fixed the missing Cc in SendMail() and Mail()
## Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release
* dramatically simplified using inline graphics ... it's fully automated and requires no user input
* added automatic document type detection for attachments and pictures
* added MsgHTML() function to replace Body tag for HTML emails
* fixed the SendMail security issues (input validation vulnerability)
* enhanced the AddAddresses functionality so that the "Name" portion is used in the email address
* removed the need to use the AltBody method (set from the HTML, or default text used)
* set the PHP Mail() function as the default (still support SendMail, SMTP Mail)
* removed the need to set the IsHTML property (set automatically)
* added Estonian language file by Indrek P&auml;ri
* added header injection patch
* added "set" method to permit users to create their own pseudo-properties like 'X-Headers', etc.
* fixed warning message in SMTP get_lines method
* added TLS/SSL SMTP support.
* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7)
* Works with PHP installed as a module or as CGI-PHP
NOTE: will NOT work with PHP5 in E_STRICT error mode
## Version 1.73 (Sun, Jun 10 2005)
* Fixed denial of service bug: http://www.cybsec.com/vuln/PHPMailer-DOS.pdf
* Now has a total of 20 translations
* Fixed alt attachments bug: http://tinyurl.com/98u9k
## Version 1.72 (Wed, May 25 2004)
* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations.
* Received: Removed this method because spam filter programs like
SpamAssassin reject this header.
* Fixed error count bug.
* SetLanguage default is now "language/".
* Fixed magic_quotes_runtime bug.
## Version 1.71 (Tue, Jul 28 2003)
* Made several speed enhancements
* Added German and Italian translation files
* Fixed HELO/AUTH bugs on keep-alive connects
* Now provides an error message if language file does not load
* Fixed attachment EOL bug
* Updated some unclear documentation
* Added additional tests and improved others
## Version 1.70 (Mon, Jun 20 2003)
* Added SMTP keep-alive support
* Added IsError method for error detection
* Added error message translation support (SetLanguage)
* Refactored many methods to increase library performance
* Hello now sends the newer EHLO message before HELO as per RFC 2821
* Removed the boundary class and replaced it with GetBoundary
* Removed queue support methods
* New $Hostname variable
* New Message-ID header
* Received header reformat
* Helo variable default changed to $Hostname
* Removed extra spaces in Content-Type definition (#667182)
* Return-Path should be set to Sender when set
* Adds Q or B encoding to headers when necessary
* quoted-encoding should now encode NULs \000
* Fixed encoding of body/AltBody (#553370)
* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC)
* Multiple bug fixes
## Version 1.65 (Fri, Aug 09 2002)
* Fixed non-visible attachment bug (#585097) for Outlook
* SMTP connections are now closed after each transaction
* Fixed SMTP::Expand return value
* Converted SMTP class documentation to phpDocumentor format
## Version 1.62 (Wed, Jun 26 2002)
* Fixed multi-attach bug
* Set proper word wrapping
* Reduced memory use with attachments
* Added more debugging
* Changed documentation to phpDocumentor format
## Version 1.60 (Sat, Mar 30 2002)
* Sendmail pipe and address patch (Christian Holtje)
* Added embedded image and read confirmation support (A. Ognio)
* Added unit tests
* Added SMTP timeout support (*nix only)
* Added possibly temporary PluginDir variable for SMTP class
* Added LE message line ending variable
* Refactored boundary and attachment code
* Eliminated SMTP class warnings
* Added SendToQueue method for future queuing support
## Version 1.54 (Wed, Dec 19 2001)
* Add some queuing support code
* Fixed a pesky multi/alt bug
* Messages are no longer forced to have "To" addresses
## Version 1.50 (Thu, Nov 08 2001)
* Fix extra lines when not using SMTP mailer
* Set WordWrap variable to int with a zero default
## Version 1.47 (Tue, Oct 16 2001)
* Fixed Received header code format
* Fixed AltBody order error
* Fixed alternate port warning
## Version 1.45 (Tue, Sep 25 2001)
* Added enhanced SMTP debug support
* Added support for multiple ports on SMTP
* Added Received header for tracing
* Fixed AddStringAttachment encoding
* Fixed possible header name quote bug
* Fixed wordwrap() trim bug
* Couple other small bug fixes
## Version 1.41 (Wed, Aug 22 2001)
* Fixed AltBody bug w/o attachments
* Fixed rfc_date() for certain mail servers
## Version 1.40 (Sun, Aug 12 2001)
* Added multipart/alternative support (AltBody)
* Documentation update
* Fixed bug in Mercury MTA
## Version 1.29 (Fri, Aug 03 2001)
* Added AddStringAttachment() method
* Added SMTP authentication support
## Version 1.28 (Mon, Jul 30 2001)
* Fixed a typo in SMTP class
* Fixed header issue with Imail (win32) SMTP server
* Made fopen() calls for attachments use "rb" to fix win32 error
## Version 1.25 (Mon, Jul 02 2001)
* Added RFC 822 date fix (Patrice)
* Added improved error handling by adding a $ErrorInfo variable
* Removed MailerDebug variable (obsolete with new error handler)
## Version 1.20 (Mon, Jun 25 2001)
* Added quoted-printable encoding (Patrice)
* Set Version as public and removed PrintVersion()
* Changed phpdoc to only display public variables and methods
## Version 1.19 (Thu, Jun 21 2001)
* Fixed MS Mail header bug
* Added fix for Bcc problem with mail(). *Does not work on Win32*
(See PHP bug report: http://www.php.net/bugs.php?id=11616)
* mail() no longer passes a fifth parameter when not needed
## Version 1.15 (Fri, Jun 15 2001)
Note: these changes contributed by Patrice Fournier
* Changed all remaining \n to \r\n
* Bcc: header no longer written to message except
when sent directly to sendmail
* Added a small message to non-MIME compliant mail reader
* Added Sender variable to change the Sender email
used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode
* Changed boundary setting to a place it will be set only once
* Removed transfer encoding for whole message when using multipart
* Message body now uses Encoding in multipart messages
* Can set encoding and type to attachments 7bit, 8bit
and binary attachment are sent as is, base64 are encoded
* Can set Encoding to base64 to send 8 bits body
through 7 bits servers
## Version 1.10 (Tue, Jun 12 2001)
* Fixed win32 mail header bug (printed out headers in message body)
## Version 1.09 (Fri, Jun 08 2001)
* Changed date header to work with Netscape mail programs
* Altered phpdoc documentation
## Version 1.08 (Tue, Jun 05 2001)
* Added enhanced error-checking
* Added phpdoc documentation to source
## Version 1.06 (Fri, Jun 01 2001)
* Added optional name for file attachments
## Version 1.05 (Tue, May 29 2001)
* Code cleanup
* Eliminated sendmail header warning message
* Fixed possible SMTP error
## Version 1.03 (Thu, May 24 2001)
* Fixed problem where qmail sends out duplicate messages
## Version 1.02 (Wed, May 23 2001)
* Added multiple recipient and attachment Clear* methods
* Added Sendmail public variable
* Fixed problem with loading SMTP library multiple times
## Version 0.98 (Tue, May 22 2001)
* Fixed problem with redundant mail hosts sending out multiple messages
* Added additional error handler code
* Added AddCustomHeader() function
* Added support for Microsoft mail client headers (affects priority)
* Fixed small bug with Mailer variable
* Added PrintVersion() function
## Version 0.92 (Tue, May 15 2001)
* Changed file names to class.phpmailer.php and class.smtp.php to match
current PHP class trend.
* Fixed problem where body not being printed when a message is attached
* Several small bug fixes
## Version 0.90 (Tue, April 17 2001)
* Initial public release

55
core/l/PHPMailer/composer.json Executable file
View File

@@ -0,0 +1,55 @@
{
"name": "phpmailer/phpmailer",
"type": "library",
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"authors": [
{
"name": "Marcus Bointon",
"email": "phpmailer@synchromedia.co.uk"
},
{
"name": "Jim Jagielski",
"email": "jimjag@gmail.com"
},
{
"name": "Andy Prevost",
"email": "codeworxtech@users.sourceforge.net"
},
{
"name": "Brent R. Matzelle"
}
],
"require": {
"php": ">=5.5.0",
"ext-ctype": "*",
"ext-filter": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.2",
"phpdocumentor/phpdocumentor": "2.*",
"phpunit/phpunit": "^4.8 || ^5.7",
"zendframework/zend-serializer": "2.7.*",
"doctrine/annotations": "1.2.*",
"zendframework/zend-eventmanager": "3.0.*",
"zendframework/zend-i18n": "2.7.3"
},
"suggest": {
"psr/log": "For optional PSR-3 debug logging",
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
"stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
"ext-mbstring": "Needed to send email in multibyte encoding charset",
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
},
"autoload": {
"psr-4": {
"PHPMailer\\PHPMailer\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"PHPMailer\\Test\\": "test/"
}
},
"license": "LGPL-2.1"
}

View File

@@ -0,0 +1,7 @@
# PHPMailer Documentation
Pre-built PHPMailer API documentation is not provided with the PHP classes, but you can generate API documentation by running `phpdoc` in the top-level folder of this project, and documentation will be generated in this folder. You will need to have [phpDocumentor](https://www.phpdoc.org) installed, though you will already have that if you installed PHPMailer using composer with dev modules enabled. This documentation is also [available online](http://phpmailer.github.io/PHPMailer/), though it may not be quite up to date or match your version exactly. The configuration for phpdoc is in the [phpdoc.dist.xml file](https://github.com/PHPMailer/PHPMailer/blob/master/phpdoc.dist.xml).
Further help and information is available in [the PHPMailer README](https://github.com/PHPMailer/PHPMailer/blob/master/README.md), [the examples folder](https://github.com/PHPMailer/PHPMailer/tree/master/examples), and in [the GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki).
Fixes and additions to documentation are welcome - please submit pull requests or improve wiki pages.

View File

@@ -0,0 +1,77 @@
<?php
/**
* This shows how to make a new public/private key pair suitable for use with DKIM.
* You should only need to do this once, and the public key (**not** the private key!)
* you generate should be inserted in your DNS matching the selector you want.
*
* You can also use the DKIM wizard here: https://www.port25.com/support/domainkeysdkim-wizard/
* but be aware that having your private key known anywhere outside your own server
* is a security risk, and it's easy enough to create your own on your own server.
*
* For security, any keys you create should not be accessible via your web site.
*
* 2048 bits is the recommended minimum key length - gmail won't accept less than 1024 bits.
* To test your DKIM config, use Port25's DKIM tester:
* https://www.port25.com/support/authentication-center/email-verification/
*
* Note that you only need a *private* key to *send* a DKIM-signed message,
* but receivers need your *public* key in order to verify it.
*
* Your public key will need to be formatted appropriately for your DNS and
* inserted there using the selector you want to use.
*/
//Set these to match your domain and chosen DKIM selector
$domain = 'example.com';
$selector = 'phpmailer';
//Path to your private key:
$privatekeyfile = 'dkim_private.pem';
//Path to your public key:
$publickeyfile = 'dkim_public.pem';
if (file_exists($privatekeyfile)) {
echo "Using existing keys - if you want to generate new keys, delete old key files first.\n\n";
$privatekey = file_get_contents($privatekeyfile);
$publickey = file_get_contents($publickeyfile);
} else {
//Create a 2048-bit RSA key with an SHA256 digest
$pk = openssl_pkey_new(
[
'digest_alg' => 'sha256',
'private_key_bits' => 2048,
'private_key_type' => OPENSSL_KEYTYPE_RSA,
]
);
//Save private key
openssl_pkey_export_to_file($pk, $privatekeyfile);
//Save public key
$pubKey = openssl_pkey_get_details($pk);
$publickey = $pubKey['key'];
file_put_contents($publickeyfile, $publickey);
$privatekey = file_get_contents($privatekeyfile);
}
echo "Private key (keep this private!):\n\n" . $privatekey;
echo "\n\nPublic key:\n\n" . $publickey;
//Prep public key for DNS, e.g.
//phpmailer._domainkey.example.com IN TXT "v=DKIM1; h=sha256; t=s; p=" "MIIBIjANBg...oXlwIDAQAB"...
$dnskey = "$selector._domainkey.$domain IN TXT";
//Some DNS server don't like ; chars unless backslash-escaped
$dnsvalue = '"v=DKIM1\; h=sha256\; t=s\; p=" ';
//Strip and split the key into smaller parts and format for DNS
//Many DNS systems don't like long TXT entries
//but are OK if it's split into 255-char chunks
//Remove PEM wrapper
$publickey = preg_replace('/^-+.*?-+$/m', '', $publickey);
//Strip line breaks
$publickey = str_replace(["\r", "\n"], '', $publickey);
//Split into chunks
$keyparts = str_split($publickey, 253); //Becomes 255 when quotes are included
//Quote each chunk
foreach ($keyparts as $keypart) {
$dnsvalue .= '"' . trim($keypart) . '" ';
}
echo "\n\nDNS key:\n\n" . trim($dnskey);
echo "\n\nDNS value:\n\n" . trim($dnsvalue);

View File

@@ -0,0 +1,41 @@
<?php
/**
* This example shows sending a DKIM-signed message with PHPMailer.
* More info about DKIM can be found here: http://www.dkim.org/info/dkim-faq.html
* There's more to using DKIM than just this code - check out this article:
* @see https://yomotherboard.com/how-to-setup-email-server-dkim-keys/
* See also the DKIM_gen_keys example code in the examples folder,
* which shows how to make a key pair from PHP.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
//Usual setup
$mail = new PHPMailer;
$mail->setFrom('from@example.com', 'First Last');
$mail->addAddress('whoto@example.com', 'John Doe');
$mail->Subject = 'PHPMailer mail() test';
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//This should be the same as the domain of your From address
$mail->DKIM_domain = 'example.com';
//See the DKIM_gen_keys.phps script for making a key pair -
//here we assume you've already done that.
//Path to your private key:
$mail->DKIM_private = 'dkim_private.pem';
//Set this to your own selector
$mail->DKIM_selector = 'phpmailer';
//Put your private key's passphrase in here if it has one
$mail->DKIM_passphrase = '';
//The identity you're signing as - usually your From address
$mail->DKIM_identity = $mail->From;
//When you send, the DKIM settings will be used to sign the message
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@@ -0,0 +1,98 @@
[![PHPMailer logo](images/phpmailer.png)](https://github.com/PHPMailer/PHPMailer)
# PHPMailer code examples
This folder contains a collection of examples of using [PHPMailer](https://github.com/PHPMailer/PHPMailer).
## About testing email sending
When working on email sending code you'll find yourself worrying about what might happen if all these test emails got sent to your mailing list. The solution is to use a fake mail server, one that acts just like the real thing, but just doesn't actually send anything out. Some offer web interfaces, feedback, logging, the ability to return specific error codes, all things that are useful for testing error handling, authentication etc. Here's a selection of mail testing tools you might like to try:
* [FakeSMTP](https://github.com/Nilhcem/FakeSMTP), a Java desktop app with the ability to show an SMTP log and save messages to a folder.
* [FakeEmail](https://github.com/isotoma/FakeEmail), a Python-based fake mail server with a web interface.
* [smtp-sink](http://www.postfix.org/smtp-sink.1.html), part of the Postfix mail server, so you may have this installed already. This is used in the Travis-CI configuration to run PHPMailer's unit tests.
* [smtp4dev](http://smtp4dev.codeplex.com), a dummy SMTP server for Windows.
* [fakesendmail.sh](https://github.com/PHPMailer/PHPMailer/blob/master/test/fakesendmail.sh), part of PHPMailer's test setup, this is a shell script that emulates sendmail for testing 'mail' or 'sendmail' methods in PHPMailer.
* [msglint](http://tools.ietf.org/tools/msglint/), not a mail server, the IETF's MIME structure analyser checks the formatting of your messages.
Most of these examples use the `example.com` and `example.net` domains. These domains are reserved by IANA for illustrative purposes, as documented in [RFC 2606](http://tools.ietf.org/html/rfc2606). Don't use made-up domains like 'mydomain.com' or 'somedomain.com' in examples as someone, somewhere, probably owns them!
## Security note
Before running these examples in a web server, you'll need to rename them with '.php' extensions. They are supplied as '.phps' files which will usually be displayed with syntax highlighting by PHP instead of running them. This prevents potential security issues with running potential spam-gateway code if you happen to deploy these code examples on a live site - _please don't do that!_
Similarly, don't leave your passwords in these files as they will be visible to the world!
## [code_generator.phps](code_generator.phps)
This script is a simple code generator - fill in the form and hit submit, and it will use what you entered to email you a message, and will also generate PHP code using your settings that you can copy and paste to use in your own apps.
## [mail.phps](mail.phps)
This is a basic example which creates an email message from an external HTML file, creates a plain text body, sets various addresses, adds an attachment and sends the message. It uses PHP's built-in mail() function which is the simplest to use, but relies on the presence of a local mail server, something which is not usually available on Windows. If you find yourself in that situation, either install a local mail server, or use a remote one and send using SMTP instead.
## [simple_contact_form.phps](simple_contact_form.phps)
This is probably the most common reason for using PHPMailer - building a contact form. This example has a basic, unstyled form and also illustrates how to filter input data before using it, how to validate addresses, how to avoid being abused as a spam gateway, and how to address messages correctly so that you don't fail SPF checks.
## [exceptions.phps](exceptions.phps)
Like the mail example, but shows how to use PHPMailer's optional exceptions for error handling.
## [extending.phps](extending.phps)
This shows how to create a subclass of PHPMailer to customise its behaviour and simplify coding in your app.
## [smtp.phps](smtp.phps)
A simple example sending using SMTP with authentication.
## [smtp_no_auth.phps](smtp_no_auth.phps)
A simple example sending using SMTP without authentication.
## [send_file_upload.phps](send_file_upload.phps)
Lots of people want to do this... This is a simple form which accepts a file upload and emails it.
## [send_multiple_file_upload.phps](send_multiple_file_upload.phps)
A slightly more complex form that allows uploading multiple files at once and sends all of them as attachments to an email.
## [sendmail.phps](sendmail.phps)
A simple example using sendmail. Sendmail is a program (usually found on Linux/BSD, OS X and other UNIX-alikes) that can be used to submit messages to a local mail server without a lengthy SMTP conversation. It's probably the fastest sending mechanism, but lacks some error reporting features. There are sendmail emulators for most popular mail servers including postfix, qmail, exim etc.
## [gmail.phps](gmail.phps)
Submitting email via Google's Gmail service is a popular use of PHPMailer. It's much the same as normal SMTP sending, just with some specific settings, namely using TLS encryption, authentication is enabled, and it connects to the SMTP submission port 587 on the smtp.gmail.com host. This example does all that.
## [gmail_xoauth.phps](gmail_xoauth.phps)
Gmail now likes you to use XOAUTH2 for SMTP authentication. This is extremely laborious to set up, but once it's done you can use it repeatedly and will no longer need Gmail's ineptly-named "Allow less secure apps" setting enabled. [Read the guide in the wiki](https://github.com/PHPMailer/PHPMailer/wiki/Using-Gmail-with-XOAUTH2) for how to set it up.
## [pop_before_smtp.phps](pop_before_smtp.phps)
Back in the stone age, before effective SMTP authentication mechanisms were available, it was common for ISPs to use POP-before-SMTP authentication. As it implies, you authenticate using the POP3 protocol (an older protocol now mostly replaced by the far superior IMAP), and then the SMTP server will allow send access from your IP address for a short while, usually 5-15 minutes. PHPMailer includes a basic POP3 protocol client with just enough functionality to carry out this sequence - it's just like a normal SMTP conversation (without authentication), but connects via POP3 first.
## [mailing_list.phps](mailing_list.phps)
This is a somewhat naïve, but reasonably efficient example of sending similar emails to a list of different addresses. It sets up a PHPMailer instance using SMTP, then connects to a MySQL database to retrieve a list of recipients. The code loops over this list, sending email to each person using their info and marks them as sent in the database. It makes use of SMTP keepalive which saves reconnecting and re-authenticating between each message.
## [ssl_options.phps](ssl_options.phps)
PHP 5.6 introduced SSL certificate verification by default, and this applies to mail servers exactly as it does to web servers. Unfortunately, SSL misconfiguration in mail servers is quite common, so this caused a common problem: those that were previously using servers with bad configs suddenly found they stopped working when they upgraded PHP. PHPMailer provides a mechanism to disable SSL certificate verification as a workaround and this example shows how to do it. Bear in mind that this is **not** a good approach - the right way is to fix your mail server config!
## [smime_signed_mail.phps](smime_signed_mail.phps)
An example of how to sign messages using [S/MIME](https://en.wikipedia.org/wiki/S/MIME), ensuring that your data can't be tampered with in transit, and proves to recipients that it was you that sent it.
* * *
## [smtp_check.phps](smtp_check.phps)
This is an example showing how to use the SMTP class by itself (without PHPMailer) to check an SMTP connection.
## [smtp_low_memory.phps](smtp_low_memory.phps)
This demonstrates how to extend the SMTP class and make PHPMailer use it. In this case it's an effort to make the SMTP class use less memory when sending large attachments.
* * *

View File

@@ -0,0 +1,75 @@
<?php
/**
* This example shows how to use a callback function from PHPMailer.
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require '../vendor/autoload.php';
/**
* Example PHPMailer callback function.
* This is a global function, but you can also pass a closure (or any other callable)
* to the `action_function` property.
*
* @param bool $result result of the send action
* @param array $to email address of the recipient
* @param array $cc cc email addresses
* @param array $bcc bcc email addresses
* @param string $subject the subject
* @param string $body the email body
*/
function callbackAction($result, $to, $cc, $bcc, $subject, $body)
{
echo "Message subject: \"$subject\"\n";
foreach ($to as $address) {
echo "Message to {$address[1]} <{$address[0]}>\n";
}
foreach ($cc as $address) {
echo "Message CC to {$address[1]} <{$address[0]}>\n";
}
foreach ($bcc as $toaddress) {
echo "Message BCC to {$toaddress[1]} <{$toaddress[0]}>\n";
}
if ($result) {
echo "Message sent successfully\n";
} else {
echo "Message send failed\n";
}
}
require_once '../vendor/autoload.php';
$mail = new PHPMailer;
try {
$mail->isMail();
$mail->setFrom('you@example.com', 'Your Name');
$mail->addAddress('jane@example.com', 'Jane Doe');
$mail->addCC('john@example.com', 'John Doe');
$mail->Subject = 'PHPMailer Test Subject';
$mail->msgHTML(file_get_contents('../examples/contents.html'));
// optional - msgHTML will create an alternate automatically
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
$mail->addAttachment('images/phpmailer_mini.png'); // attachment
$mail->action_function = 'callbackAction';
$mail->send();
} catch (Exception $e) {
echo $e->errorMessage();
}
//Alternative approach using a closure
try {
$mail->action_function = function ($result, $to, $cc, $bcc, $subject, $body) {
if ($result) {
echo "Message sent successfully\n";
} else {
echo "Message send failed\n";
}
};
$mail->send();
} catch (Exception $e) {
echo $e->errorMessage();
}

View File

@@ -0,0 +1,71 @@
<?php
/**
* This example shows how to handle a simple contact form.
*/
$msg = '';
//Don't run this unless we're handling a form submission
if (array_key_exists('email', $_POST)) {
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP - requires a local mail server
//Faster and safer than using mail()
$mail->isSMTP();
$mail->Host = 'localhost';
$mail->Port = 25;
//Use a fixed address in your own domain as the from address
//**DO NOT** use the submitter's address here as it will be forgery
//and will cause your messages to fail SPF checks
$mail->setFrom('from@example.com', 'First Last');
//Send the message to yourself, or whoever should receive contact for submissions
$mail->addAddress('whoto@example.com', 'John Doe');
//Put the submitter's address in a reply-to header
//This will fail if the address provided is invalid,
//in which case we should ignore the whole request
if ($mail->addReplyTo($_POST['email'], $_POST['name'])) {
$mail->Subject = 'PHPMailer contact form';
//Keep it simple - don't use HTML
$mail->isHTML(false);
//Build a simple message body
$mail->Body = <<<EOT
Email: {$_POST['email']}
Name: {$_POST['name']}
Message: {$_POST['message']}
EOT;
//Send the message, check for errors
if (!$mail->send()) {
//The reason for failing to send will be in $mail->ErrorInfo
//but you shouldn't display errors to users - process the error, log it on your server.
$msg = 'Sorry, something went wrong. Please try again later.';
} else {
$msg = 'Message sent! Thanks for contacting us.';
}
} else {
$msg = 'Invalid email address, message ignored.';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Contact form</title>
</head>
<body>
<h1>Contact us</h1>
<?php if (!empty($msg)) {
echo "<h2>$msg</h2>";
} ?>
<form method="POST">
<label for="name">Name: <input type="text" name="name" id="name"></label><br>
<label for="email">Email address: <input type="email" name="email" id="email"></label><br>
<label for="message">Message: <textarea name="message" id="message" rows="8" cols="20"></textarea></label><br>
<input type="submit" value="Send">
</form>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>PHPMailer Test</title>
</head>
<body>
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<h1>This is a test of PHPMailer.</h1>
<div align="center">
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
</div>
<p>This example uses <strong>HTML</strong>.</p>
<p>ISO-8859-1 text: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></p>
</div>
</body>
</html>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Test</title>
</head>
<body>
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<h1>This is a test of PHPMailer.</h1>
<div align="center">
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
</div>
<p>This example uses <strong>HTML</strong> with the UTF-8 unicode charset.</p>
<p>Chinese text: 郵件內容為空</p>
<p>Russian text: Пустое тело сообщения</p>
<p>Armenian text: Հաղորդագրությունը դատարկ է</p>
<p>Czech text: Prázdné tělo zprávy</p>
<p>Emoji: <span style="font-size: 48px">😂 🦄 💥 📤 📧</span></p>
<p>Image data URL (base64)<img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="#"></p>
<p>Image data URL (URL-encoded)<img src="data:image/gif,GIF89a%01%00%01%00%00%00%00%21%F9%04%01%0A%00%01%00%2C%00%00%00%00%01%00%01%00%00%02%02L%01%00%3B" alt="#"></p>
</div>
</body>
</html>

View File

@@ -0,0 +1,39 @@
<?php
/**
* This example shows how to make use of PHPMailer's exceptions for error handling.
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require '../vendor/autoload.php';
//Create a new PHPMailer instance
//Passing true to the constructor enables the use of exceptions for error handling
$mail = new PHPMailer(true);
try {
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer Exceptions test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//and convert the HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message
//Note that we don't need check the response from this because it will throw an exception if it has trouble
$mail->send();
echo 'Message sent!';
} catch (Exception $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (\Exception $e) { //The leading slash means the Global PHP Exception class will be caught
echo $e->getMessage(); //Boring error messages from anything else!
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* This example shows how to extend PHPMailer to simplify your coding.
* If PHPMailer doesn't do something the way you want it to, or your code
* contains too much boilerplate, don't edit the library files,
* create a subclass instead and customise that.
* That way all your changes will be retained when PHPMailer is updated.
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require '../vendor/autoload.php';
/**
* Use PHPMailer as a base class and extend it
*/
class myPHPMailer extends PHPMailer
{
/**
* myPHPMailer constructor.
*
* @param bool|null $exceptions
* @param string $body A default HTML message body
*/
public function __construct($exceptions, $body = '')
{
//Don't forget to do this or other things may not be set correctly!
parent::__construct($exceptions);
//Set a default 'From' address
$this->setFrom('joe@example.com', 'Joe User');
//Send via SMTP
$this->isSMTP();
//Equivalent to setting `Host`, `Port` and `SMTPSecure` all at once
$this->Host = 'tls://smtp.example.com:587';
//Set an HTML and plain-text body, import relative image references
$this->msgHTML($body, './images/');
//Show debug output
$this->SMTPDebug = 2;
//Inject a new debug output handler
$this->Debugoutput = function ($str, $level) {
echo "Debug level $level; message: $str\n";
};
}
//Extend the send function
public function send()
{
$this->Subject = '[Yay for me!] ' . $this->Subject;
$r = parent::send();
echo "I sent a message with subject " . $this->Subject;
return $r;
}
}
//Now creating and sending a message becomes simpler when you use this class in your app code
try {
//Instantiate your new class, making use of the new `$body` parameter
$mail = new myPHPMailer(true, '<strong>This is the message body</strong>');
// Now you only need to set things that are different from the defaults you defined
$mail->addAddress('jane@example.com', 'Jane User');
$mail->Subject = 'Here is the subject';
$mail->addAttachment(__FILE__, 'myPHPMailer.php');
$mail->send(); //no need to check for errors - the exception handler will do it
} catch (Exception $e) {
//Note that this is catching the PHPMailer Exception class, not the global \Exception type!
echo "Caught a " . get_class($e) . ": " . $e->getMessage();
}

View File

@@ -0,0 +1,98 @@
<?php
/**
* This example shows settings to use when sending via Google's Gmail servers.
* This uses traditional id & password authentication - look at the gmail_xoauth.phps
* example to see how to use XOAUTH2.
* The IMAP section shows how to save this message to the 'Sent Mail' folder using IMAP commands.
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
// use
// $mail->Host = gethostbyname('smtp.gmail.com');
// if your network does not support SMTP over IPv6
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "username@gmail.com";
//Password to use for SMTP authentication
$mail->Password = "yourpassword";
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer GMail SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
//Section 2: IMAP
//Uncomment these to save your message in the 'Sent Mail' folder.
#if (save_mail($mail)) {
# echo "Message saved!";
#}
}
//Section 2: IMAP
//IMAP commands requires the PHP IMAP Extension, found at: https://php.net/manual/en/imap.setup.php
//Function to call which uses the PHP imap_*() functions to save messages: https://php.net/manual/en/book.imap.php
//You can use imap_getmailboxes($imapStream, '/imap/ssl') to get a list of available folders or labels, this can
//be useful if you are trying to get this working on a non-Gmail IMAP server.
function save_mail($mail)
{
//You can change 'Sent Mail' to any other folder or tag
$path = "{imap.gmail.com:993/imap/ssl}[Gmail]/Sent Mail";
//Tell your server to open an IMAP connection using the same username and password as you used for SMTP
$imapStream = imap_open($path, $mail->Username, $mail->Password);
$result = imap_append($imapStream, $path, $mail->getSentMIMEMessage());
imap_close($imapStream);
return $result;
}

View File

@@ -0,0 +1,105 @@
<?php
/**
* This example shows how to send via Google's Gmail servers using XOAUTH2 authentication.
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\OAuth;
// Alias the League Google OAuth2 provider class
use League\OAuth2\Client\Provider\Google;
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
//Load dependencies from composer
//If this causes an error, run 'composer install'
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Set AuthType to use XOAUTH2
$mail->AuthType = 'XOAUTH2';
//Fill in authentication details here
//Either the gmail account owner, or the user that gave consent
$email = 'someone@gmail.com';
$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
//Obtained by configuring and running get_oauth_token.php
//after setting up an app in Google Developer Console.
$refreshToken = 'RANDOMCHARS-----DWxgOvPT003r-yFUV49TQYag7_Aod7y0';
//Create a new OAuth2 provider instance
$provider = new Google(
[
'clientId' => $clientId,
'clientSecret' => $clientSecret,
]
);
//Pass the OAuth provider instance to PHPMailer
$mail->setOAuth(
new OAuth(
[
'provider' => $provider,
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'refreshToken' => $refreshToken,
'userName' => $email,
]
)
);
//Set who the message is to be sent from
//For gmail, this generally needs to be the same as the user you logged in as
$mail->setFrom($email, 'First Last');
//Set who the message is to be sent to
$mail->addAddress('someone@gmail.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer GMail XOAUTH2 SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->CharSet = 'utf-8';
$mail->msgHTML(file_get_contents('contentsutf8.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,34 @@
<?php
/**
* This example shows sending a message using PHP's mail() function.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@@ -0,0 +1,65 @@
<?php
/**
* This example shows how to send a message to a whole list of recipients efficiently.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
error_reporting(E_STRICT | E_ALL);
date_default_timezone_set('Etc/UTC');
require '../vendor/autoload.php';
$mail = new PHPMailer;
$body = file_get_contents('contents.html');
$mail->isSMTP();
$mail->Host = 'smtp.example.com';
$mail->SMTPAuth = true;
$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead
$mail->Port = 25;
$mail->Username = 'yourname@example.com';
$mail->Password = 'yourpassword';
$mail->setFrom('list@example.com', 'List manager');
$mail->addReplyTo('list@example.com', 'List manager');
$mail->Subject = "PHPMailer Simple database mailing list test";
//Same body for all messages, so set this before the sending loop
//If you generate a different body for each recipient (e.g. you're using a templating system),
//set it inside the loop
$mail->msgHTML($body);
//msgHTML also sets AltBody, but if you want a custom one, set it afterwards
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
//Connect to the database and select the recipients from your mailing list that have not yet been sent to
//You'll need to alter this to match your database
$mysql = mysqli_connect('localhost', 'username', 'password');
mysqli_select_db($mysql, 'mydb');
$result = mysqli_query($mysql, 'SELECT full_name, email, photo FROM mailinglist WHERE sent = FALSE');
foreach ($result as $row) {
$mail->addAddress($row['email'], $row['full_name']);
if (!empty($row['photo'])) {
$mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); //Assumes the image data is stored in the DB
}
if (!$mail->send()) {
echo "Mailer Error (" . str_replace("@", "&#64;", $row["email"]) . ') ' . $mail->ErrorInfo . '<br />';
break; //Abandon sending
} else {
echo "Message sent to :" . $row['full_name'] . ' (' . str_replace("@", "&#64;", $row['email']) . ')<br />';
//Mark it as sent in the DB
mysqli_query(
$mysql,
"UPDATE mailinglist SET sent = TRUE WHERE email = '" .
mysqli_real_escape_string($mysql, $row['email']) . "'"
);
}
// Clear all addresses and attachments for next loop
$mail->clearAddresses();
$mail->clearAttachments();
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* This example shows how to use POP-before-SMTP for authentication.
* POP-before-SMTP is a very old technology that is hardly used any more.
*/
//Import PHPMailer classes into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\POP3;
require '../vendor/autoload.php';
//Authenticate via POP3.
//After this you should be allowed to submit messages over SMTP for a few minutes.
//Only applies if your host supports POP-before-SMTP.
$pop = POP3::popBeforeSmtp('pop3.example.com', 110, 30, 'username', 'password', 1);
//Create a new PHPMailer instance
//Passing true to the constructor enables the use of exceptions for error handling
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Set the hostname of the mail server
$mail->Host = 'mail.example.com';
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = false;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer POP-before-SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//and convert the HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message
//Note that we don't need check the response from this because it will throw an exception if it has trouble
$mail->send();
echo 'Message sent!';
} catch (Exception $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (\Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}

View File

@@ -0,0 +1,52 @@
<?php
/**
* PHPMailer simple file upload and send example.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
$msg = '';
if (array_key_exists('userfile', $_FILES)) {
// First handle the upload
// Don't trust provided filename - same goes for MIME types
// See http://php.net/manual/en/features.file-upload.php#114004 for more thorough upload validation
$uploadfile = tempnam(sys_get_temp_dir(), hash('sha256', $_FILES['userfile']['name']));
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
// Upload handled successfully
// Now create a message
require '../vendor/autoload.php';
$mail = new PHPMailer;
$mail->setFrom('from@example.com', 'First Last');
$mail->addAddress('whoto@example.com', 'John Doe');
$mail->Subject = 'PHPMailer file sender';
$mail->Body = 'My message body';
// Attach the uploaded file
$mail->addAttachment($uploadfile, 'My uploaded file');
if (!$mail->send()) {
$msg .= "Mailer Error: " . $mail->ErrorInfo;
} else {
$msg .= "Message sent!";
}
} else {
$msg .= 'Failed to move file to ' . $uploadfile;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Upload</title>
</head>
<body>
<?php if (empty($msg)) { ?>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="100000"> Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
<?php } else {
echo $msg;
} ?>
</body>
</html>

View File

@@ -0,0 +1,53 @@
<?php
/**
* PHPMailer multiple files upload and send example
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
$msg = '';
if (array_key_exists('userfile', $_FILES)) {
require '../vendor/autoload.php';
// Create a message
$mail = new PHPMailer;
$mail->setFrom('from@example.com', 'First Last');
$mail->addAddress('whoto@example.com', 'John Doe');
$mail->Subject = 'PHPMailer file sender';
$mail->Body = 'My message body';
//Attach multiple files one by one
for ($ct = 0; $ct < count($_FILES['userfile']['tmp_name']); $ct++) {
$uploadfile = tempnam(sys_get_temp_dir(), hash('sha256', $_FILES['userfile']['name'][$ct]));
$filename = $_FILES['userfile']['name'][$ct];
if (move_uploaded_file($_FILES['userfile']['tmp_name'][$ct], $uploadfile)) {
$mail->addAttachment($uploadfile, $filename);
} else {
$msg .= 'Failed to move file to ' . $uploadfile;
}
}
if (!$mail->send()) {
$msg .= "Mailer Error: " . $mail->ErrorInfo;
} else {
$msg .= "Message sent!";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Upload</title>
</head>
<body>
<?php if (empty($msg)) { ?>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Select one or more files:
<input name="userfile[]" type="file" multiple="multiple">
<input type="submit" value="Send Files">
</form>
<?php } else {
echo $msg;
} ?>
</body>
</html>

View File

@@ -0,0 +1,36 @@
<?php
/**
* This example shows sending a message using a local sendmail binary.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
// Set PHPMailer to use the sendmail transport
$mail->isSendmail();
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer sendmail test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@@ -0,0 +1,101 @@
<?php
/**
* PHPMailer simple contact form example.
* If you want to accept and send uploads in your form, look at the send_file_upload example.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
if (array_key_exists('to', $_POST)) {
$err = false;
$msg = '';
$email = '';
//Apply some basic validation and filtering to the subject
if (array_key_exists('subject', $_POST)) {
$subject = substr(strip_tags($_POST['subject']), 0, 255);
} else {
$subject = 'No subject given';
}
//Apply some basic validation and filtering to the query
if (array_key_exists('query', $_POST)) {
//Limit length and strip HTML tags
$query = substr(strip_tags($_POST['query']), 0, 16384);
} else {
$query = '';
$msg = 'No query provided!';
$err = true;
}
//Apply some basic validation and filtering to the name
if (array_key_exists('name', $_POST)) {
//Limit length and strip HTML tags
$name = substr(strip_tags($_POST['name']), 0, 255);
} else {
$name = '';
}
//Validate to address
//Never allow arbitrary input for the 'to' address as it will turn your form into a spam gateway!
//Substitute appropriate addresses from your own domain, or simply use a single, fixed address
if (array_key_exists('to', $_POST) and in_array($_POST['to'], ['sales', 'support', 'accounts'])) {
$to = $_POST['to'] . '@example.com';
} else {
$to = 'support@example.com';
}
//Make sure the address they provided is valid before trying to use it
if (array_key_exists('email', $_POST) and PHPMailer::validateAddress($_POST['email'])) {
$email = $_POST['email'];
} else {
$msg .= "Error: invalid email address provided";
$err = true;
}
if (!$err) {
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'localhost';
$mail->Port = 2500;
$mail->CharSet = 'utf-8';
//It's important not to use the submitter's address as the from address as it's forgery,
//which will cause your messages to fail SPF checks.
//Use an address in your own domain as the from address, put the submitter's address in a reply-to
$mail->setFrom('contact@example.com', (empty($name) ? 'Contact form' : $name));
$mail->addAddress($to);
$mail->addReplyTo($email, $name);
$mail->Subject = 'Contact form: ' . $subject;
$mail->Body = "Contact form submission\n\n" . $query;
if (!$mail->send()) {
$msg .= "Mailer Error: " . $mail->ErrorInfo;
} else {
$msg .= "Message sent!";
}
}
} ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Contact Form</title>
</head>
<body>
<h1>Contact us</h1>
<?php if (empty($msg)) { ?>
<form method="post">
<label for="to">Send to:</label>
<select name="to" id="to">
<option value="sales">Sales</option>
<option value="support" selected="selected">Support</option>
<option value="accounts">Accounts</option>
</select><br>
<label for="subject">Subject: <input type="text" name="subject" id="subject" maxlength="255"></label><br>
<label for="name">Your name: <input type="text" name="name" id="name" maxlength="255"></label><br>
<label for="email">Your email address: <input type="email" name="email" id="email" maxlength="255"></label><br>
<label for="query">Your question:</label><br>
<textarea cols="30" rows="8" name="query" id="query" placeholder="Your question"></textarea><br>
<input type="submit" value="Submit">
</form>
<?php } else {
echo $msg;
} ?>
</body>
</html>

View File

@@ -0,0 +1,98 @@
<?php
/**
* This PHPMailer example shows S/MIME signing a message and then sending.
*
* Before you can sign the mail certificates are needed.
*
*
* STEP 1 - Creating a certificate:
* You can either use a self-signed certificate, pay for a signed one,
* or use free alternatives such as StartSSL, Comodo etc.
* Check out this link for more providers: http://kb.mozillazine.org/Getting_an_SMIME_certificate
* In this example I am using Comodo.
* The form is directly available via https://secure.comodo.com/products/frontpage?area=SecureEmailCertificate
* Fill it out and you'll get an email with a link to download your certificate.
* Usually the certificate will be directly installed into your browser (FireFox/Chrome).
*
*
* STEP 2 - Exporting the certificate
* This is specific to your browser, however, most browsers will give you the option
* to export your recently added certificate in PKCS12 (.pfx)
* Include your private key if you are asked for it.
* Set up a password to protect your exported file.
*
* STEP 3 - Splitting the .pfx into a private key and the certificate.
* I use openssl for this. You only need two commands. In my case the certificate file is called 'exported-cert.pfx'
* To create the private key do the following:
*
* openssl pkcs12 -in exported-cert.pfx -nocerts -out cert.key
*
* Of course the way you name your file (-out) is up to you.
* You will be asked for a password for the Import password. This is the password you
* set while exporting the certificate into the pfx file.
* Afterwards, you can password protect your private key (recommended)
* Also make sure to set the permissions to a minimum level and suitable for your application.
* To create the certificate file use the following command:
*
* openssl pkcs12 -in exported-cert.pfx -clcerts -nokeys -out cert.crt
*
* Again, the way you name your certificate is up to you. You will be also asked for the Import Password.
* To create the certificate-chain file use the following command:
*
* openssl pkcs12 -in exported-cert.pfx -cacerts -out certchain.pem
*
* Again, the way you name your chain file is up to you. You will be also asked for the Import Password.
*
*
* STEP 3 - Code
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Set who the message is to be sent from
//IMPORTANT: This must match the email address of your certificate.
//Although the certificate will be valid, an error will be thrown since it cannot be verified
//that the sender and the signer are the same person.
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//Convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//Configure message signing (the actual signing does not occur until sending)
$mail->sign(
'/path/to/cert.crt', //The location of your certificate file
'/path/to/cert.key', //The location of your private key file
//The password you protected your private key with (not the Import Password!
//May be empty but the parameter must not be omitted!
'yourSecretPrivateKeyPassword',
'/path/to/certchain.pem' //The location of your chain file
);
//Send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
/*
* REMARKS:
* If your email client does not support S/MIME it will most likely just show an attachment smime.p7s,
* which is the signature contained in the email.
* Other clients, such as Thunderbird support S/MIME natively and will validate the signature
* automatically and report the result in some way.
*/

View File

@@ -0,0 +1,55 @@
<?php
/**
* This example shows making an SMTP connection with authentication.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Set the hostname of the mail server
$mail->Host = 'mail.example.com';
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = 'yourname@example.com';
//Password to use for SMTP authentication
$mail->Password = 'yourpassword';
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent!';
}

View File

@@ -0,0 +1,59 @@
<?php
/**
* This uses the SMTP class alone to check that a connection can be made to an SMTP server,
* authenticate, then disconnect
*/
//Import the PHPMailer SMTP class into the global namespace
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require '../vendor/autoload.php';
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
//Create a new SMTP instance
$smtp = new SMTP;
//Enable connection-level debug output
$smtp->do_debug = SMTP::DEBUG_CONNECTION;
try {
//Connect to an SMTP server
if (!$smtp->connect('mail.example.com', 25)) {
throw new Exception('Connect failed');
}
//Say hello
if (!$smtp->hello(gethostname())) {
throw new Exception('EHLO failed: ' . $smtp->getError()['error']);
}
//Get the list of ESMTP services the server offers
$e = $smtp->getServerExtList();
//If server can do TLS encryption, use it
if (is_array($e) && array_key_exists('STARTTLS', $e)) {
$tlsok = $smtp->startTLS();
if (!$tlsok) {
throw new Exception('Failed to start encryption: ' . $smtp->getError()['error']);
}
//Repeat EHLO after STARTTLS
if (!$smtp->hello(gethostname())) {
throw new Exception('EHLO (2) failed: ' . $smtp->getError()['error']);
}
//Get new capabilities list, which will usually now include AUTH if it didn't before
$e = $smtp->getServerExtList();
}
//If server supports authentication, do it (even if no encryption)
if (is_array($e) && array_key_exists('AUTH', $e)) {
if ($smtp->authenticate('username', 'password')) {
echo "Connected ok!";
} else {
throw new Exception('Authentication failed: ' . $smtp->getError()['error']);
}
}
} catch (Exception $e) {
echo 'SMTP error: ' . $e->getMessage(), "\n";
}
//Whatever happened, close the connection.
$smtp->quit(true);

View File

@@ -0,0 +1,130 @@
<?php
/**
* SMTP low memory example.
*/
namespace PHPMailer\PHPMailer;
require '../vendor/autoload.php';
/**
* This class demonstrates sending an already-built RFC822 message via SMTP
* by extending PHPMailer's SMTP class.
* It uses less memory that PHPMailer's usual approach because it keeps
* the message as a single string rather than splitting its lines into
* an array, which can consume very large amounts of memory if you have
* large attachments. The downside is that it's somewhat slower.
* This is mainly of academic interest, but shows how you can change how
* core classes work without having to alter the library itself.
*/
class SMTPLowMemory extends SMTP
{
public function data($msg_data)
{
//This will use the standard timelimit
if (!$this->sendCommand('DATA', 'DATA', 354)) {
return false;
}
/* The server is ready to accept data!
* According to rfc821 we should not send more than 1000 characters on a single line (including the LE)
* so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
* smaller lines to fit within the limit.
* We will also look for lines that start with a '.' and prepend an additional '.'.
* NOTE: this does not count towards line-length limit.
*/
// Normalize line breaks
$msg_data = str_replace(["\r\n", "\r"], "\n", $msg_data);
/* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
* of the first line (':' separated) does not contain a space then it _should_ be a header and we will
* process all lines before a blank line as headers.
*/
$firstline = substr($msg_data, 0, strcspn($msg_data, "\n", 0));
$field = substr($firstline, 0, strpos($firstline, ':'));
$in_headers = false;
if (!empty($field) && strpos($field, ' ') === false) {
$in_headers = true;
}
$offset = 0;
$len = strlen($msg_data);
while ($offset < $len) {
//Get position of next line break
$linelen = strcspn($msg_data, "\n", $offset);
//Get the next line
$line = substr($msg_data, $offset, $linelen);
//Remember where we have got to
$offset += ($linelen + 1);
$lines_out = [];
if ($in_headers and $line == '') {
$in_headers = false;
}
//We need to break this line up into several smaller lines
//This is a small micro-optimisation: isset($str[$len]) is equivalent to (strlen($str) > $len)
while (isset($line[self::MAX_LINE_LENGTH])) {
//Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on
//so as to avoid breaking in the middle of a word
$pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' ');
//Deliberately matches both false and 0
if (!$pos) {
//No nice break found, add a hard break
$pos = self::MAX_LINE_LENGTH - 1;
$lines_out[] = substr($line, 0, $pos);
$line = substr($line, $pos);
} else {
//Break at the found point
$lines_out[] = substr($line, 0, $pos);
//Move along by the amount we dealt with
$line = substr($line, $pos + 1);
}
//If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
if ($in_headers) {
$line = "\t" . $line;
}
}
$lines_out[] = $line;
//Send the lines to the server
foreach ($lines_out as $line_out) {
//RFC2821 section 4.5.2
if (!empty($line_out) and $line_out[0] == '.') {
$line_out = '.' . $line_out;
}
$this->client_send($line_out . self::LE);
}
}
//Message data has been sent, complete the command
//Increase timelimit for end of DATA command
$savetimelimit = $this->Timelimit;
$this->Timelimit = $this->Timelimit * 2;
$result = $this->sendCommand('DATA END', '.', 250);
//Restore timelimit
$this->Timelimit = $savetimelimit;
return $result;
}
}
/**
* We need to use a PHPMailer subclass to make it use our SMTP implementation.
* @package PHPMailer\PHPMailer
*/
class PHPMailerLowMemory extends PHPMailer
{
/**
* Patch in the new SMTP class.
* @return SMTP
*/
public function getSMTPInstance()
{
if (!is_object($this->smtp)) {
$this->smtp = new SMTPLowMemory;
}
return $this->smtp;
}
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* This example shows making an SMTP connection without using authentication.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Set the hostname of the mail server
$mail->Host = 'mail.example.com';
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//We don't need to set this as it's the default value
//$mail->SMTPAuth = false;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer SMTP without auth test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@@ -0,0 +1,75 @@
<?php
/**
* This example shows settings to use when sending over SMTP with TLS and custom connection options.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require '../vendor/autoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Set the hostname of the mail server
$mail->Host = 'smtp.example.com';
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Custom connection options
//Note that these settings are INSECURE
$mail->SMTPOptions = array(
'ssl' => [
'verify_peer' => true,
'verify_depth' => 3,
'allow_self_signed' => true,
'peer_name' => 'smtp.example.com',
'cafile' => '/etc/ssl/ca_cert.pem',
],
);
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = 'username@example.com';
//Password to use for SMTP authentication
$mail->Password = 'yourpassword';
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer SMTP options test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), __DIR__);
//Send the message, check for errors
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent!';
}

View File

@@ -0,0 +1,144 @@
<?php
/**
* PHPMailer - PHP email creation and transport class.
* PHP Version 5.5
* @package PHPMailer
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2017 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* Get an OAuth2 token from an OAuth2 provider.
* * Install this script on your server so that it's accessible
* as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
* e.g.: http://localhost/phpmailer/get_oauth_token.php
* * Ensure dependencies are installed with 'composer install'
* * Set up an app in your Google/Yahoo/Microsoft account
* * Set the script address as the app's redirect URL
* If no refresh token is obtained when running this file,
* revoke access to your app and run the script again.
*/
namespace PHPMailer\PHPMailer;
/**
* Aliases for League Provider Classes
* Make sure you have added these to your composer.json and run `composer install`
* Plenty to choose from here:
* @see http://oauth2-client.thephpleague.com/providers/thirdparty/
*/
// @see https://github.com/thephpleague/oauth2-google
use League\OAuth2\Client\Provider\Google;
// @see https://packagist.org/packages/hayageek/oauth2-yahoo
use Hayageek\OAuth2\Client\Provider\Yahoo;
// @see https://github.com/stevenmaguire/oauth2-microsoft
use Stevenmaguire\OAuth2\Client\Provider\Microsoft;
if (!isset($_GET['code']) && !isset($_GET['provider'])) {
?>
<html>
<body>Select Provider:<br/>
<a href='?provider=Google'>Google</a><br/>
<a href='?provider=Yahoo'>Yahoo</a><br/>
<a href='?provider=Microsoft'>Microsoft/Outlook/Hotmail/Live/Office365</a><br/>
</body>
</html>
<?php
exit;
}
require 'vendor/autoload.php';
session_start();
$providerName = '';
if (array_key_exists('provider', $_GET)) {
$providerName = $_GET['provider'];
$_SESSION['provider'] = $providerName;
} elseif (array_key_exists('provider', $_SESSION)) {
$providerName = $_SESSION['provider'];
}
if (!in_array($providerName, ['Google', 'Microsoft', 'Yahoo'])) {
exit('Only Google, Microsoft and Yahoo OAuth2 providers are currently supported in this script.');
}
//These details are obtained by setting up an app in the Google developer console,
//or whichever provider you're using.
$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
//If this automatic URL doesn't work, set it yourself manually to the URL of this script
$redirectUri = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
//$redirectUri = 'http://localhost/PHPMailer/redirect';
$params = [
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'redirectUri' => $redirectUri,
'accessType' => 'offline'
];
$options = [];
$provider = null;
switch ($providerName) {
case 'Google':
$provider = new Google($params);
$options = [
'scope' => [
'https://mail.google.com/'
]
];
break;
case 'Yahoo':
$provider = new Yahoo($params);
break;
case 'Microsoft':
$provider = new Microsoft($params);
$options = [
'scope' => [
'wl.imap',
'wl.offline_access'
]
];
break;
}
if (null === $provider) {
exit('Provider missing');
}
if (!isset($_GET['code'])) {
// If we don't have an authorization code then get one
$authUrl = $provider->getAuthorizationUrl($options);
$_SESSION['oauth2state'] = $provider->getState();
header('Location: ' . $authUrl);
exit;
// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
unset($_SESSION['oauth2state']);
unset($_SESSION['provider']);
exit('Invalid state');
} else {
unset($_SESSION['provider']);
// Try to get an access token (using the authorization code grant)
$token = $provider->getAccessToken(
'authorization_code',
[
'code' => $_GET['code']
]
);
// Use this to interact with an API on the users behalf
// Use this to get a new access token if the old one expires
echo 'Refresh Token: ', $token->getRefreshToken();
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Armenian PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Hrayr Grigoryan <hrayr@bits.am>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP -ի սխալ: չհաջողվեց ստուգել իսկությունը.';
$PHPMAILER_LANG['connect_host'] = 'SMTP -ի սխալ: չհաջողվեց կապ հաստատել SMTP սերվերի հետ.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP -ի սխալ: տվյալները ընդունված չեն.';
$PHPMAILER_LANG['empty_message'] = 'Հաղորդագրությունը դատարկ է';
$PHPMAILER_LANG['encoding'] = 'Կոդավորման անհայտ տեսակ: ';
$PHPMAILER_LANG['execute'] = 'Չհաջողվեց իրականացնել հրամանը: ';
$PHPMAILER_LANG['file_access'] = 'Ֆայլը հասանելի չէ: ';
$PHPMAILER_LANG['file_open'] = 'Ֆայլի սխալ: ֆայլը չհաջողվեց բացել: ';
$PHPMAILER_LANG['from_failed'] = 'Ուղարկողի հետևյալ հասցեն սխալ է: ';
$PHPMAILER_LANG['instantiate'] = 'Հնարավոր չէ կանչել mail ֆունկցիան.';
$PHPMAILER_LANG['invalid_address'] = 'Հասցեն սխալ է: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' փոստային սերվերի հետ չի աշխատում.';
$PHPMAILER_LANG['provide_address'] = 'Անհրաժեշտ է տրամադրել գոնե մեկ ստացողի e-mail հասցե.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP -ի սխալ: չի հաջողվել ուղարկել հետևյալ ստացողների հասցեներին: ';
$PHPMAILER_LANG['signing'] = 'Ստորագրման սխալ: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP -ի connect() ֆունկցիան չի հաջողվել';
$PHPMAILER_LANG['smtp_error'] = 'SMTP սերվերի սխալ: ';
$PHPMAILER_LANG['variable_set'] = 'Չի հաջողվում ստեղծել կամ վերափոխել փոփոխականը: ';
$PHPMAILER_LANG['extension_missing'] = 'Հավելվածը բացակայում է: ';

View File

@@ -0,0 +1,27 @@
<?php
/**
* Arabic PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author bahjat al mostafa <bahjat983@hotmail.com>
*/
$PHPMAILER_LANG['authenticate'] = 'خطأ SMTP : لا يمكن تأكيد الهوية.';
$PHPMAILER_LANG['connect_host'] = 'خطأ SMTP: لا يمكن الاتصال بالخادم SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'خطأ SMTP: لم يتم قبول المعلومات .';
$PHPMAILER_LANG['empty_message'] = 'نص الرسالة فارغ';
$PHPMAILER_LANG['encoding'] = 'ترميز غير معروف: ';
$PHPMAILER_LANG['execute'] = 'لا يمكن تنفيذ : ';
$PHPMAILER_LANG['file_access'] = 'لا يمكن الوصول للملف: ';
$PHPMAILER_LANG['file_open'] = 'خطأ في الملف: لا يمكن فتحه: ';
$PHPMAILER_LANG['from_failed'] = 'خطأ على مستوى عنوان المرسل : ';
$PHPMAILER_LANG['instantiate'] = 'لا يمكن توفير خدمة البريد.';
$PHPMAILER_LANG['invalid_address'] = 'الإرسال غير ممكن لأن عنوان البريد الإلكتروني غير صالح: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.';
$PHPMAILER_LANG['provide_address'] = 'يجب توفير عنوان البريد الإلكتروني لمستلم واحد على الأقل.';
$PHPMAILER_LANG['recipients_failed'] = 'خطأ SMTP: الأخطاء التالية ' .
'فشل في الارسال لكل من : ';
$PHPMAILER_LANG['signing'] = 'خطأ في التوقيع: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() غير ممكن.';
$PHPMAILER_LANG['smtp_error'] = 'خطأ على مستوى الخادم SMTP: ';
$PHPMAILER_LANG['variable_set'] = 'لا يمكن تعيين أو إعادة تعيين متغير: ';
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';

View File

@@ -0,0 +1,26 @@
<?php
/**
* Azerbaijani PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author @mirjalal
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP xətası: Giriş uğursuz oldu.';
$PHPMAILER_LANG['connect_host'] = 'SMTP xətası: SMTP serverinə qoşulma uğursuz oldu.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP xətası: Verilənlər qəbul edilməyib.';
$PHPMAILER_LANG['empty_message'] = 'Boş mesaj göndərilə bilməz.';
$PHPMAILER_LANG['encoding'] = 'Qeyri-müəyyən kodlaşdırma: ';
$PHPMAILER_LANG['execute'] = 'Əmr yerinə yetirilmədi: ';
$PHPMAILER_LANG['file_access'] = 'Fayla giriş yoxdur: ';
$PHPMAILER_LANG['file_open'] = 'Fayl xətası: Fayl açıla bilmədi: ';
$PHPMAILER_LANG['from_failed'] = 'Göstərilən poçtlara göndərmə uğursuz oldu: ';
$PHPMAILER_LANG['instantiate'] = 'Mail funksiyası işə salına bilmədi.';
$PHPMAILER_LANG['invalid_address'] = 'Düzgün olmayan e-mail adresi: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' - e-mail kitabxanası dəstəklənmir.';
$PHPMAILER_LANG['provide_address'] = 'Ən azı bir e-mail adresi daxil edilməlidir.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP xətası: Aşağıdakı ünvanlar üzrə alıcılara göndərmə uğursuzdur: ';
$PHPMAILER_LANG['signing'] = 'İmzalama xətası: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP serverinə qoşulma uğursuz oldu.';
$PHPMAILER_LANG['smtp_error'] = 'SMTP serveri xətası: ';
$PHPMAILER_LANG['variable_set'] = 'Dəyişənin quraşdırılması uğursuz oldu: ';
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';

View File

@@ -0,0 +1,26 @@
<?php
/**
* Bosnian PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Ermin Islamagić <ermin@islamagic.com>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Greška: Neuspjela prijava.';
$PHPMAILER_LANG['connect_host'] = 'SMTP Greška: Nije moguće spojiti se sa SMTP serverom.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Greška: Podatci nisu prihvaćeni.';
$PHPMAILER_LANG['empty_message'] = 'Sadržaj poruke je prazan.';
$PHPMAILER_LANG['encoding'] = 'Nepoznata kriptografija: ';
$PHPMAILER_LANG['execute'] = 'Nije moguće izvršiti naredbu: ';
$PHPMAILER_LANG['file_access'] = 'Nije moguće pristupiti datoteci: ';
$PHPMAILER_LANG['file_open'] = 'Nije moguće otvoriti datoteku: ';
$PHPMAILER_LANG['from_failed'] = 'SMTP Greška: Slanje sa navedenih e-mail adresa nije uspjelo: ';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Greška: Slanje na navedene e-mail adrese nije uspjelo: ';
$PHPMAILER_LANG['instantiate'] = 'Ne mogu pokrenuti mail funkcionalnost.';
$PHPMAILER_LANG['invalid_address'] = 'E-mail nije poslan. Neispravna e-mail adresa: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nije podržan.';
$PHPMAILER_LANG['provide_address'] = 'Definišite barem jednu adresu primaoca.';
$PHPMAILER_LANG['signing'] = 'Greška prilikom prijave: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Spajanje na SMTP server nije uspjelo.';
$PHPMAILER_LANG['smtp_error'] = 'SMTP greška: ';
$PHPMAILER_LANG['variable_set'] = 'Nije moguće postaviti varijablu ili je vratiti nazad: ';
$PHPMAILER_LANG['extension_missing'] = 'Nedostaje ekstenzija: ';

View File

@@ -0,0 +1,26 @@
<?php
/**
* Belarusian PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Aleksander Maksymiuk <info@setpro.pl>
*/
$PHPMAILER_LANG['authenticate'] = 'Памылка SMTP: памылка ідэнтыфікацыі.';
$PHPMAILER_LANG['connect_host'] = 'Памылка SMTP: нельга ўстанавіць сувязь з SMTP-серверам.';
$PHPMAILER_LANG['data_not_accepted'] = 'Памылка SMTP: звесткі непрынятыя.';
$PHPMAILER_LANG['empty_message'] = 'Пустое паведамленне.';
$PHPMAILER_LANG['encoding'] = 'Невядомая кадыроўка тэксту: ';
$PHPMAILER_LANG['execute'] = 'Нельга выканаць каманду: ';
$PHPMAILER_LANG['file_access'] = 'Няма доступу да файла: ';
$PHPMAILER_LANG['file_open'] = 'Нельга адкрыць файл: ';
$PHPMAILER_LANG['from_failed'] = 'Няправільны адрас адпраўніка: ';
$PHPMAILER_LANG['instantiate'] = 'Нельга прымяніць функцыю mail().';
$PHPMAILER_LANG['invalid_address'] = 'Нельга даслаць паведамленне, няправільны email атрымальніка: ';
$PHPMAILER_LANG['provide_address'] = 'Запоўніце, калі ласка, правільны email атрымальніка.';
$PHPMAILER_LANG['mailer_not_supported'] = ' - паштовы сервер не падтрымліваецца.';
$PHPMAILER_LANG['recipients_failed'] = 'Памылка SMTP: няправільныя атрымальнікі: ';
$PHPMAILER_LANG['signing'] = 'Памылка подпісу паведамлення: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Памылка сувязі з SMTP-серверам.';
$PHPMAILER_LANG['smtp_error'] = 'Памылка SMTP: ';
$PHPMAILER_LANG['variable_set'] = 'Нельга ўстанавіць або перамяніць значэнне пераменнай: ';
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';

View File

@@ -0,0 +1,26 @@
<?php
/**
* Bulgarian PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Mikhail Kyosev <mialygk@gmail.com>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP грешка: Не може да се удостовери пред сървъра.';
$PHPMAILER_LANG['connect_host'] = 'SMTP грешка: Не може да се свърже с SMTP хоста.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP грешка: данните не са приети.';
$PHPMAILER_LANG['empty_message'] = 'Съдържанието на съобщението е празно';
$PHPMAILER_LANG['encoding'] = 'Неизвестно кодиране: ';
$PHPMAILER_LANG['execute'] = 'Не може да се изпълни: ';
$PHPMAILER_LANG['file_access'] = 'Няма достъп до файл: ';
$PHPMAILER_LANG['file_open'] = 'Файлова грешка: Не може да се отвори файл: ';
$PHPMAILER_LANG['from_failed'] = 'Следните адреси за подател са невалидни: ';
$PHPMAILER_LANG['instantiate'] = 'Не може да се инстанцира функцията mail.';
$PHPMAILER_LANG['invalid_address'] = 'Невалиден адрес: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' - пощенски сървър не се поддържа.';
$PHPMAILER_LANG['provide_address'] = 'Трябва да предоставите поне един email адрес за получател.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP грешка: Следните адреси за Получател са невалидни: ';
$PHPMAILER_LANG['signing'] = 'Грешка при подписване: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP провален connect().';
$PHPMAILER_LANG['smtp_error'] = 'SMTP сървърна грешка: ';
$PHPMAILER_LANG['variable_set'] = 'Не може да се установи или възстанови променлива: ';
$PHPMAILER_LANG['extension_missing'] = 'Липсва разширение: ';

View File

@@ -0,0 +1,26 @@
<?php
/**
* Catalan PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Ivan <web AT microstudi DOT com>
*/
$PHPMAILER_LANG['authenticate'] = 'Error SMTP: No sha pogut autenticar.';
$PHPMAILER_LANG['connect_host'] = 'Error SMTP: No es pot connectar al servidor SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Dades no acceptades.';
$PHPMAILER_LANG['empty_message'] = 'El cos del missatge està buit.';
$PHPMAILER_LANG['encoding'] = 'Codificació desconeguda: ';
$PHPMAILER_LANG['execute'] = 'No es pot executar: ';
$PHPMAILER_LANG['file_access'] = 'No es pot accedir a larxiu: ';
$PHPMAILER_LANG['file_open'] = 'Error dArxiu: No es pot obrir larxiu: ';
$PHPMAILER_LANG['from_failed'] = 'La(s) següent(s) adreces de remitent han fallat: ';
$PHPMAILER_LANG['instantiate'] = 'No sha pogut crear una instància de la funció Mail.';
$PHPMAILER_LANG['invalid_address'] = 'Adreça demail invalida: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer no està suportat';
$PHPMAILER_LANG['provide_address'] = 'Sha de proveir almenys una adreça demail com a destinatari.';
$PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Els següents destinataris han fallat: ';
$PHPMAILER_LANG['signing'] = 'Error al signar: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Ha fallat el SMTP Connect().';
$PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: ';
$PHPMAILER_LANG['variable_set'] = 'No sha pogut establir o restablir la variable: ';
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';

View File

@@ -0,0 +1,26 @@
<?php
/**
* Chinese PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author LiuXin <http://www.80x86.cn/blog/>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:身份验证失败。';
$PHPMAILER_LANG['connect_host'] = 'SMTP 错误: 不能连接SMTP主机。';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误: 数据不可接受。';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = '未知编码:';
$PHPMAILER_LANG['execute'] = '不能执行: ';
$PHPMAILER_LANG['file_access'] = '不能访问文件:';
$PHPMAILER_LANG['file_open'] = '文件错误:不能打开文件:';
$PHPMAILER_LANG['from_failed'] = '下面的发送地址邮件发送失败了: ';
$PHPMAILER_LANG['instantiate'] = '不能实现mail方法。';
//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' 您所选择的发送邮件的方法并不支持。';
$PHPMAILER_LANG['provide_address'] = '您必须提供至少一个 收信人的email地址。';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误: 下面的 收件人失败了: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';

View File

@@ -0,0 +1,25 @@
<?php
/**
* Czech PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
*/
$PHPMAILER_LANG['authenticate'] = 'Chyba SMTP: Autentizace selhala.';
$PHPMAILER_LANG['connect_host'] = 'Chyba SMTP: Nelze navázat spojení se SMTP serverem.';
$PHPMAILER_LANG['data_not_accepted'] = 'Chyba SMTP: Data nebyla přijata.';
$PHPMAILER_LANG['empty_message'] = 'Prázdné tělo zprávy';
$PHPMAILER_LANG['encoding'] = 'Neznámé kódování: ';
$PHPMAILER_LANG['execute'] = 'Nelze provést: ';
$PHPMAILER_LANG['file_access'] = 'Nelze získat přístup k souboru: ';
$PHPMAILER_LANG['file_open'] = 'Chyba souboru: Nelze otevřít soubor pro čtení: ';
$PHPMAILER_LANG['from_failed'] = 'Následující adresa odesílatele je nesprávná: ';
$PHPMAILER_LANG['instantiate'] = 'Nelze vytvořit instanci emailové funkce.';
$PHPMAILER_LANG['invalid_address'] = 'Neplatná adresa: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer není podporován.';
$PHPMAILER_LANG['provide_address'] = 'Musíte zadat alespoň jednu emailovou adresu příjemce.';
$PHPMAILER_LANG['recipients_failed'] = 'Chyba SMTP: Následující adresy příjemců nejsou správně: ';
$PHPMAILER_LANG['signing'] = 'Chyba přihlašování: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() selhal.';
$PHPMAILER_LANG['smtp_error'] = 'Chyba SMTP serveru: ';
$PHPMAILER_LANG['variable_set'] = 'Nelze nastavit nebo změnit proměnnou: ';
$PHPMAILER_LANG['extension_missing'] = 'Chybí rozšíření: ';

View File

@@ -0,0 +1,26 @@
<?php
/**
* Danish PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Mikael Stokkebro <info@stokkebro.dk>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP fejl: Kunne ikke logge på.';
$PHPMAILER_LANG['connect_host'] = 'SMTP fejl: Kunne ikke tilslutte SMTP serveren.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fejl: Data kunne ikke accepteres.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Ukendt encode-format: ';
$PHPMAILER_LANG['execute'] = 'Kunne ikke køre: ';
$PHPMAILER_LANG['file_access'] = 'Ingen adgang til fil: ';
$PHPMAILER_LANG['file_open'] = 'Fil fejl: Kunne ikke åbne filen: ';
$PHPMAILER_LANG['from_failed'] = 'Følgende afsenderadresse er forkert: ';
$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere email funktionen.';
//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer understøttes ikke.';
$PHPMAILER_LANG['provide_address'] = 'Du skal indtaste mindst en modtagers emailadresse.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere er forkerte: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';

View File

@@ -0,0 +1,25 @@
<?php
/**
* German PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP-Fehler: Authentifizierung fehlgeschlagen.';
$PHPMAILER_LANG['connect_host'] = 'SMTP-Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-Fehler: Daten werden nicht akzeptiert.';
$PHPMAILER_LANG['empty_message'] = 'E-Mail-Inhalt ist leer.';
$PHPMAILER_LANG['encoding'] = 'Unbekannte Kodierung: ';
$PHPMAILER_LANG['execute'] = 'Konnte folgenden Befehl nicht ausführen: ';
$PHPMAILER_LANG['file_access'] = 'Zugriff auf folgende Datei fehlgeschlagen: ';
$PHPMAILER_LANG['file_open'] = 'Dateifehler: Konnte folgende Datei nicht öffnen: ';
$PHPMAILER_LANG['from_failed'] = 'Die folgende Absenderadresse ist nicht korrekt: ';
$PHPMAILER_LANG['instantiate'] = 'Mail-Funktion konnte nicht initialisiert werden.';
$PHPMAILER_LANG['invalid_address'] = 'Die Adresse ist ungültig: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wird nicht unterstützt.';
$PHPMAILER_LANG['provide_address'] = 'Bitte geben Sie mindestens eine Empfängeradresse an.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP-Fehler: Die folgenden Empfänger sind nicht korrekt: ';
$PHPMAILER_LANG['signing'] = 'Fehler beim Signieren: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Verbindung zum SMTP-Server fehlgeschlagen.';
$PHPMAILER_LANG['smtp_error'] = 'Fehler vom SMTP-Server: ';
$PHPMAILER_LANG['variable_set'] = 'Kann Variable nicht setzen oder zurücksetzen: ';
$PHPMAILER_LANG['extension_missing'] = 'Fehlende Erweiterung: ';

View File

@@ -0,0 +1,25 @@
<?php
/**
* Greek PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Σφάλμα: Αδυναμία πιστοποίησης (authentication).';
$PHPMAILER_LANG['connect_host'] = 'SMTP Σφάλμα: Αδυναμία σύνδεσης στον SMTP-Host.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Σφάλμα: Τα δεδομένα δεν έγιναν αποδεκτά.';
$PHPMAILER_LANG['empty_message'] = 'Το E-Mail δεν έχει περιεχόμενο .';
$PHPMAILER_LANG['encoding'] = 'Αγνωστο Encoding-Format: ';
$PHPMAILER_LANG['execute'] = 'Αδυναμία εκτέλεσης ακόλουθης εντολής: ';
$PHPMAILER_LANG['file_access'] = 'Αδυναμία προσπέλασης του αρχείου: ';
$PHPMAILER_LANG['file_open'] = 'Σφάλμα Αρχείου: Δεν είναι δυνατό το άνοιγμα του ακόλουθου αρχείου: ';
$PHPMAILER_LANG['from_failed'] = 'Η παρακάτω διεύθυνση αποστολέα δεν είναι σωστή: ';
$PHPMAILER_LANG['instantiate'] = 'Αδυναμία εκκίνησης Mail function.';
$PHPMAILER_LANG['invalid_address'] = 'Το μήνυμα δεν εστάλη, η διεύθυνση δεν είναι έγκυρη: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer δεν υποστηρίζεται.';
$PHPMAILER_LANG['provide_address'] = 'Παρακαλούμε δώστε τουλάχιστον μια e-mail διεύθυνση παραλήπτη.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Σφάλμα: Οι παρακάτω διευθύνσεις παραλήπτη δεν είναι έγκυρες: ';
$PHPMAILER_LANG['signing'] = 'Σφάλμα υπογραφής: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Αποτυχία σύνδεσης στον SMTP Server.';
$PHPMAILER_LANG['smtp_error'] = 'Σφάλμα από τον SMTP Server: ';
$PHPMAILER_LANG['variable_set'] = 'Αδυναμία ορισμού ή αρχικοποίησης μεταβλητής: ';
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';

Some files were not shown because too many files have changed in this diff Show More