'; $to = $_POST['email']; $subject = "$name"." event notify"; $body = "Hi, \n\n$name $event at $time\n\n------------\n\nThis mail is auto generated by mail api."; $headers = array( 'From' => "$from", 'To' => "$to", 'Subject' => "$subject" ); $smtp = Mail::factory('smtp', array( 'host' => 'ssl://smtp.gmail.com', 'port' => '465', 'auth' => true, 'username' => 'noreply.watcher@gmail.com', 'password' => 'YOUR_PASSWORD' )); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo('
' . $mail->getMessage() . '
'); } else { #echo('Email successfully sent!'); } ?>