Send an SMS message.

@param string    $phoneNumber
@param string    $templateId
@param array     $personalisation
@param string    $reference

@return array
160806
public function sendSms( $phoneNumber, $templateId, array $personalisation = array(), $reference = '', $smsSenderId = NULL ){

        return $this->httpPost(
            self::PATH_NOTIFICATION_SEND_SMS,
            $this->buildSmsPayload( 'sms', $phoneNumber, $templateId, $personalisation, $reference, $smsSenderId)
        );

    }
462278
public function createCustomer($first_name, $last_name, $email, $phone)
    {
        return $this->getCustomerModel()->make($first_name, $last_name, $email, $phone)->save();
    }
248016
public function sendSMS($phoneCountryCode, $phoneNumber, $message) {

        // concatenate to create the Twilio friendly phone number
        $phone  = $this->buildPhoneNumber($phoneCountryCode, $phoneNumber);

        // Get the Twilio config settings
        $twilioConfigSettings = $this->getTwilioConfig();

        // Send the text message via Twilio's API
        $twilio = new \Aloha\Twilio\Twilio(
            $twilioConfigSettings['sid'],
            $twilioConfigSettings['token'],
            $twilioConfigSettings['fromNumber']
        );
        $twilio->message($phone, $message);
    }
700715
public function send($mobileNumber, $message, $messageId = null)
    {
        return $this->app['chikka.sender']->send($mobileNumber, $message, $messageId);
    }
814603
private function sendEmail(UserInterface $user, \Swift_Mailer $mailer, $subject, $body, $templateId)
    {
        if (\is_array($body)) {
            $body['email'] = $user->getEmail();
            $body['fullname'] = $user->getProfile()->getFullName();
        } else {
            $body = [
                'email' => $user->getEmail(),
                'fullname' => $user->getProfile()->getFullName(),
                'content' => $body,
            ];
        }

        // Create Message
        $message = (new PdSwiftMessage())
            ->setTemplateId($templateId)
            ->setFrom($this->getParameter('pd_user.mail_sender_address'), $this->getParameter('pd_user.mail_sender_name'))
            ->setTo($user->getEmail())
            ->setSubject($subject)
            ->setBody(serialize($body), 'text/html');

        return (bool)$mailer->send($message);
    }
893370
public function sendSmsToViettelWithWebService()
    {
        $this->logger->debug(__FUNCTION__, 'Input Data Send SMS to Viettel Web Service => ' . json_encode($this->inputData));
        $phone_number = $this->inputData['phone_number'];
        $msg          = $this->inputData['msg'];
        $alias        = $this->inputData['alias'];
        $params       = $this->inputData['params'];
        $phone_number = $this->phoneNumber->vn_convert_phone_number($phone_number, 'new');
        $content      = trim($msg);
        $url          = $this->wsConfig['api_link'];
        $token        = $this->wsConfig['token'];
        $prefix       = $this->wsConfig['prefix'];
        $method       = $this->wsConfig['method'];
        $validStr     = $phone_number . $prefix . $content . $prefix . $params . $prefix . $token;
        // Request Data với XML thuần
        $params = array(
            'msisdn'    => $phone_number,
            'content'   => $content,
            'alias'     => $alias,
            'type'      => $params,
            'signature' => md5($validStr)
        );
        $this->logger->debug(__FUNCTION__, 'SendSms To Webservice');
        $this->logger->debug(__FUNCTION__, 'SendSms Method: ' . json_encode($method));
        $this->logger->debug(__FUNCTION__, 'MT Message Length: ' . $this->lengthMtMessage($msg));
        if (strtoupper($method) == 'GET') {
            $this->logger->debug(__FUNCTION__, 'SendSms Url: ' . json_encode($url . '?' . http_build_query($params)));
        } else {
            $this->logger->debug(__FUNCTION__, 'SendSms Url: ' . json_encode($url));
            $this->logger->debug(__FUNCTION__, 'SendSms Params: ' . json_encode($params));
        }
        $this->logger->debug(__FUNCTION__, 'SendSms String to Valid: ' . json_encode($validStr));
        $this->logger->debug(__FUNCTION__, 'SendSms Token: ' . json_encode($this->wsConfig['token']));
        $this->logger->debug(__FUNCTION__, 'SendSms Prefix: ' . json_encode($this->wsConfig['prefix']));
        $requestSms = $this->requests->sendRequest($url, $params, $method);
        $this->logger->debug(__FUNCTION__, 'SendSms Result: ' . json_encode($requestSms));
        $responseSms = json_decode(trim($requestSms));
        if ($responseSms === NULL || empty($responseSms)) {
            $result = array(
                'code'          => self::API_ERROR_CODE,
                'description'   => 'Error',
                'data'          => array(
                    'msg'           => 'Không gửi được MT. Response từ API về không hợp lệ',
                    'requestResult' => $requestSms
                ),
                'request_data'  => array('url' => $url, 'params' => $params, 'method' => $method),
                'response_data' => $responseSms,
                'content_data'  => array(
                    'phone_number' => $params['msisdn'],
                    'msg'          => $params['content'],
                    'mo'           => isset($this->inputData['mo']) ? $this->inputData['mo'] : NULL,
                    'note'         => isset($this->inputData['note']) ? $this->inputData['note'] : NULL,
                    'subCode'      => isset($this->inputData['subCode']) ? $this->inputData['subCode'] : NULL
                )
            );
        } else {
            if (isset($responseSms->Result) && $responseSms->Result == self::SEND_SMS_SUCCESS) {
                $result = array(
                    'code'          => self::EXIT_SUCCESS,
                    'description'   => 'Success',
                    'data'          => array('requestResult' => $requestSms),
                    'request_data'  => array('url' => $url, 'params' => $params, 'method' => $method),
                    'response_data' => $responseSms,
                    'content_data'  => array(
                        'phone_number' => $params['msisdn'],
                        'msg'          => $params['content'],
                        'mo'           => isset($this->inputData['mo']) ? $this->inputData['mo'] : NULL,
                        'note'         => isset($this->inputData['note']) ? $this->inputData['note'] : NULL,
                        'subCode'      => isset($this->inputData['subCode']) ? $this->inputData['subCode'] : NULL
                    )
                );
            } else {
                $result = array(
                    'code'          => self::EXIT_ERROR,
                    'description'   => 'Failed',
                    'data'          => array('requestResult' => $requestSms),
                    'request_data'  => array('url' => $url, 'params' => $params, 'method' => $method),
                    'response_data' => $responseSms,
                    'content_data'  => array(
                        'phone_number' => $params['msisdn'],
                        'msg'          => $params['content'],
                        'mo'           => isset($this->inputData['mo']) ? $this->inputData['mo'] : NULL,
                        'note'         => isset($this->inputData['note']) ? $this->inputData['note'] : NULL,
                        'subCode'      => isset($this->inputData['subCode']) ? $this->inputData['subCode'] : NULL
                    )
                );
            }
        }
        if ($this->responseIsObject) {
            $result = Utils::arrayToObject($result);
        }
        $this->sendSmsResult = $result;
        $this->logger->info(__FUNCTION__, 'Send SMS Result: ' . json_encode($this->sendSmsResult));

        return $this;
    }
391453
public function sendMobileMessage($mobile, $type, $param = [], $uid = 0) 
	{
		if (!$this->plat) {
			return hst_message(hst_lang('hstcms::manage.sms.plat.choose.error'));
		}
		$this->type = CommonSmsModel::getType($type);
		if (!$this->type) {
			return hst_message(hst_lang('hstcms::manage.sms.plat.choose.error'));
		}
		$code = CommonSmsCodeModel::_buildCode();
		$content = $this->_buildContent($code, $type);
		$number = $this->checkTodayNum($mobile, $type);
		if (hst_message_verify($number)) {
			return $number;
		}
		$param['code'] = $code;
		$param['product'] = hst_config('sms', 'product');
		$result = $this->plat->sendMobileMessage($mobile, $content, $param);
		if (hst_message_verify($result)) {
			return $result;
		}
		$results = CommonSmsCodeModel::addInfo($mobile, $type, $code, $number);
		if($results) {
			CommonSmsModel::addInfo($mobile, $type, $code, $content, json_encode($param), (int)$result['res']['type'], $result['res']['requestid'], $uid);
		}
		return true;
	}
15396
public function sendConfirmationEmail(
        $recipient,
        ApiOrderInterface $apiOrder,
        $templatePath,
        ContactInterface $customerContact = null
    ) {
        if (empty($recipient)) {
            $this->writeLog('No recipient specified.');

            return false;
        }

        $tmplData = array(
            'order' => $apiOrder,
            'contact' => $customerContact,
        );

        return $this->sendOrderMail($recipient, $templatePath, $tmplData, $apiOrder);
    }
210730
def send(phone_number, message, wait_for_user_anwser=false, slow_multi_sms=false)
      body = {
        numero_destino: phone_number,
        mensagem: message,
        resposta_usuario: wait_for_user_anwser,
        multi_sms: slow_multi_sms
      }

      puts self.class.post('/sms', {body: body.to_json})
    end
697616
protected function sendMail(UserRegistrationInterface $registrationRecord, $subject, $template)
    {
        $user = $registrationRecord->getUser();
        $message = $this->mailService->compose(
            ['to' => $user->getEmail()], 
            $template, 
            ['user' => $user, 'registrationRecord' => $registrationRecord]
        );

        $fromEmail = $this->options->getEmailFromAddress();
        if ($fromEmail) {
            $message->setFrom($fromEmail);
        }

        $message->setSubject($subject);

        return $this->mailService->send($message);        
    }
598699
def send(phone_number, audio_url, wait_for_user_anwser=false, shown_number=nil)
      body = {
        numero_destino: phone_number,
        url_audio: audio_url,
        resposta_usuario: wait_for_user_anwser,
        shown_number: shown_number
      }

      puts self.class.post('/audio', {body: body.to_json})
    end
609671
public function sendCustomerConfirmation(
        $recipient,
        ApiOrderInterface $apiOrder,
        ContactInterface $customerContact = null
    ) {
        if (!$this->sendEmailConfirmationToCustomer) {
            return false;
        }

        return $this->sendConfirmationEmail(
            $recipient,
            $apiOrder,
            $this->templateCustomerConfirmationPath,
            $customerContact
        );
    }
765803
public function addNext($text, $template = null)
    {
        if(!empty($text))
        {
            $this->callToActions = ['message' => ['text' => $text]];
        }
        
        if(!empty($template))
        {
            if($template instanceof StructuredMessage)
            {
                $this->callToActions = ['message' => [$template->getDataForCall(FALSE)]];
            }
            else
            {
                throw new MessengerPlatformException('Template for welcome message is not StructuredMessage.', 4);
            }
        }
    }
228325
public function setPhoneNumber(PhoneNumber $phoneNumber)
    {
        if (!is_a($phoneNumber, PhoneNumber::class, false))
        {
            throw new InvalidArgumentException("The phone number is not an instance of the PhoneNumber class.");
        }

        $this->phoneNumbers[$phoneNumber->getType()] = $phoneNumber;
    }
1000373
public Sms from(String name, String phoneNumber) {
		return from(name, new PhoneNumber(phoneNumber));
	}
1226481
public function sendEmail( $emailAddress, $templateId, array $personalisation = array(), $reference = '', $emailReplyToId = NULL ){

        return $this->httpPost(
            self::PATH_NOTIFICATION_SEND_EMAIL,
            $this->buildEmailPayload( 'email', $emailAddress, $templateId, $personalisation, $reference, $emailReplyToId )
        );

    }
704081
public function createMessage(string $templatePath, array $context): Message
    {
        $template = $this->twig->loadTemplate($templatePath);
        $context = $this->twig->mergeGlobals($context);

        return new Message(
            $this->renderBlock($template, 'title', $context),
            $this->renderBlock($template, 'subject', $context),
            $this->createMessageContent($template, $context),
            EmailAddresses::fromString(trim($this->renderBlock($template, 'to', $context))),
            EmailAddresses::fromString(trim($this->renderBlock($template, 'cc', $context))),
            EmailAddresses::fromString(trim($this->renderBlock($template, 'bcc', $context))),
            EmailAddress::fromString(trim($this->renderBlock($template, 'sender', $context))),
            EmailAddresses::fromString(trim($this->renderBlock($template, 'from', $context)))
        );
    }