Skip to main content


Showing posts from February, 2015

Cakephp Email Setting

Basic usage First of all, you should ensure the class is loaded using App::uses(): App::uses('CakeEmail', 'Network/Email'); Using CakeEmail is similar to using EmailComponent. But instead of using attributes you use methods. Example: $Email = new CakeEmail(); $Email->from(array('' => 'My Site')); $Email->to(''); $Email->subject('About'); $Email->send('My message'); To enable the transport, add the following information to your Config/email.php: You can configure SSL SMTP servers such as Gmail. To do so, prefix the host with 'ssl://' and configure the port value accordingly. Example: class EmailConfig {     public $gmail = array(         'host' => 'ssl://',         'port' => 465,         'username' => '',         'password' => 'secret',         'transport' =

PHP OOPS Concept

Encapsulation: Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. The wrapping up of data and methods into a single unit (called class) is known as encapsulation. The benefit of encapsulating is that it performs the task inside without making you worry. Polymorphism : Objects could be of any type. A discrete object can have discrete properties and methods which work separately to other objects. However a set of objects could be derived from a parent object and retain some properties of the parent class. This process is called polymorphism. An object could be morphed into several other objects retaining some of its behavior. Inheritance : The key process of deriving a new object by extending another object is called inheritance. When you inherit an object from another object, the subclass (which inherits) derives all the properties and methods of the superclass (which is inherited). A s


**  * Uses PHP IMAP extension, so make sure it is enabled in your php.ini,  * extension=php_imap.dll  */  set_time_limit(3000);  /* connect to gmail with your credentials */ $hostname = '{}INBOX'; $username = 'YOUR_GMAIL_USERNAME'; # e.g $password = 'YOUR_GMAIL_PASSWORD'; /* try to connect */ $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error()); $emails = imap_search($inbox,'ALL'); /* useful only if the above search is set to 'ALL' */ $max_emails = 16; /* if any emails found, iterate through each email */ if($emails) {     $count = 1;         /* put the newest emails on top */     rsort($emails);         /* for every email... */     foreach($emails as $email_number)     {         /* get information specific to this email */         $overview = imap_fetch_overview($inbox,$email_number,0);         /* get ma