Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email configurations by CakePhp #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions Config/email.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package app.Config
* @since CakePHP(tm) v 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/

/**
* This is email configuration file.
* Use it to configure email transports of CakePHP.
* Email configuration class.
* You can specify multiple configurations for production, development and testing.
* transport => The name of a supported transport; valid options are as follows:
* Mail - Send using PHP mail function
* Smtp - Send using SMTP
* Debug - Do not send the email, just return the result
* You can add custom transports (or override existing transports) by adding the
* appropriate file to app/Network/Email. Transports should be named 'YourTransport.php',
* where 'Your' is the name of the transport.
* from =>
* The origin email. See CakeEmail::from() about the valid values
*
* @see http://book.cakephp.org/2.0/en/core-utility-libraries/email.html#configuration
*/
class EmailConfig
{
/**
* Default email config. Provide your own data
* @var array
*/
public $default = array(
'transport' => 'Mail',
'from' => array(),
'returnPath' => null,
);

public function __construct() {
$defaultEmail = 'croogo@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
if(empty($this->default['from'])) {
$this->default['from'][$defaultEmail] = Configure::read('Site.title');
}
if(empty($this->default['returnPath'])) {
$this->default['returnPath'] = $defaultEmail;
}
}
}