contact = $contact; $this->message = $message; $this->mail = $mail; $this->subject = $subject; try { $this->client = new Client(Messenger::AccountSid,Messenger::AuthToken); }catch (Exception $e){ echo $e->getMessage(); } } public function sendSms() { try { /* $sms = $this->client->account->messages->create( // the number we are sending to - Any phone number $this->getContact(), array( // Step 6: Change the 'From' number below to be a valid Twilio number // that you've purchased 'from' => Messenger::sender_number, 'body' => $this->getMessage() ) );*/ return true; }catch(Exception $e){ // echo json_encode(["message"=>$e->getMessage(),"line"=>$e->getLine(),"trace"=>$e->getTrace()]); return false; } } public function sendMail(){ return mail($this->getMail(),$this->getSubject(),$this->getMessage(),$this->getHeader()); } /** * @return mixed */ public function getHeader() { return $this->header; } /** * @param mixed $header */ public function setHeader($header) { $this->header = $header; } /** * @return null */ public function getContact() { return $this->contact; } /** * @param null $contact */ public function setContact($contact) { $this->contact = $contact; } /** * @return null */ public function getMessage() { return $this->message; } /** * @param null $message */ public function setMessage($message) { $this->message = $message; } /** * @return null */ public function getMail() { return $this->mail; } /** * @param null $mail */ public function setMail($mail) { $this->mail = $mail; } /** * @return null */ public function getSubject() { return $this->subject; } /** * @param null $subject */ public function setSubject($subject) { $this->subject = $subject; } public function checkPhoneExist($phone) { try { $phone_number = $this->client->lookups->v1->phoneNumbers($phone) ->fetch(); return isset($phone_number); } catch(Exception $ex){ return false; } } }