contact = $contact; $this->message = $message; // Instantiation and passing `true` enables exceptions $this->mail = new PHPMailer(true); // $this->mail = $mail; $this->subject = $subject; //Server settings // $mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output $this->mail->isSMTP(); // Send using SMTP $this->mail->Host = 'mail.ilink-app.com'; // Set the SMTP server to send through $this->mail->SMTPAuth = true; // Enable SMTP authentication $this->mail->Username = 'noreply@ilink-app.com'; // SMTP username $this->mail->Password = 'ilink2017GA'; // SMTP password $this->mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged $this->mail->Port = 587; $this->mail->CharSet = 'UTF-8'; 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(){ //Recipients $this->mail->setFrom('noreply@ilink-app.com', 'iLink World'); $this->mail->addAddress($this->getReceiverMail()); // Add a recipient // Content // $this->mail->isHTML(true); // Set email format to HTML $this->mail->Subject = $this->getSubject(); $this->mail->Body = $this->getMessage(); // $this->mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $this->mail->send(); // 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 getReceiverMail() { return $this->receiverMail; } /** * @param null $mail */ public function setReceiverMail($mail) { $this->receiverMail = $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; } } }