// Pear Mail Library require_once "Mail.php"; $from = ''; //change this to your email address $to = ''; // change to address $subject = 'Insert subject here'; // subject of mail $body = "Hello world! this is the content of the email"; //content of mail $headers = array( 'From' => $from, 'To' => $to, 'Subject' => $subject ); $smtp = Mail::factory('smtp', array( 'host' => 'ssl://smtp.gmail.com', 'port' => '465', 'auth' => true, 'username' => 'djaxmail21@gmail.com', //your gmail account 'password' => 'ma1234567890il' // your password )); // Send the mail $mail = $smtp->send($to, $headers, $body); //check mail sent or not if (PEAR::isError($mail)) { echo '

'.$mail->getMessage().'

'; } else { echo '

Message successfully sent!

'; }