Posted by
erawat – 26/06/2010
Today, I opened my notebook and found a short note that I wrote about Test Driven Development which I was trying to summarise the definition and process of it.
Test Driven Development (TDD) is a simple software development technique that can be divided into three simple stages:
- Write a test first
- Write the code to make the test pass
- Repeat (using Refactoring)
Additional details
- Introduction to Test Driven Design (TDD)
Erawat
Posted by
erawat – 26/03/2010
Time to blog.
I have to implement a small web application which contains email system function. This is an example how to send an email with PHP and Gmail.
require_once 'Mail.php';
$from = "Forename Surname <example@googlemail.com>" //sender email;
$mailTo = "example@gmail.com"; //destination
$subject = "Send this mail from PHP!"; //email subject
$body = "Hello,\n\n How are you?"; //email body
$host = "smtp.gmail.com"; //Outgoing Mail (SMTP) Server
$port = "587"; //Set port
$username = "example@gmail.com"; //sender account
$password = "password"; //sender password
$headers = array ('From' => $from,
'To' => $mailTo,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body); //call send method
Resources:
http://pear.php.net/manual/en/package.mail.mail.factory.php
http://mail.google.com/support/bin/answer.py?hl=en&answer=13287
Erawat.