public function check_mail() { $responses = array("Okay. Checking for new emails.", "Please wait, while i check for new unread emails"); if ($this->speak) { TTS::Speak($responses); } echo "Gmail: Checking emails!\n"; $newemails = $this->count_unread_mails(); if ($newemails > 0) { if ($this->speak) { TTS::Speak("You have " . $newemails . " unread emails."); } // Prompt, do you want me to read them for you? Prompt::Set("Do you want me to read them for you?", 'Gmail', 'prompt_read_email_subject'); shell_exec("sudo /etc/init.d/SAM listenquitely"); } else { $response = array("You have no new emails.", "No new emails found in your inbox.", "Your inbox is empty."); if ($this->speak) { TTS::Speak($response); } } }