Source for file generic_smtp.php
Documentation is available at generic_smtp.php
* Generic e-mail based SMS driver
* Copyright 2005-2007 WebSprockets, LLC
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
* This driver interfaces with the email-to-sms gateways provided by many
* carriers, particularly those based in the U.S.
* $Horde: framework/Net_SMS/SMS/generic_smtp.php,v 1.15 2007/06/27 17:22:58 jan Exp $
* @author Ian Eure <ieure@php.net>
* @param array $params Parameters.
* Capabilities of this driver.
'cingular' => '%s@mmode.com',
'verizon' => '%s@vtext.com',
'boost' => '%s@myboostmobile.com',
'cellularone' => '%s@mycellone.net',
'cincybell' => '%s@gocbw.com',
'sprint' => '%s@messaging.sprintpcs.com',
'tmobile_us' => '%s@tmomail.com',
'suncom' => '%s@tms.suncom.com',
'aircel' => '%s@airsms.com',
'airtel' => '%s@airtelmail.com',
'bplmobile' => '%s@bplmobile.com',
'bellmobility' => '%s@txt.bellmobility.ca',
'bluegrass' => '%s@sms.bluecell.com',
'cellforce' => '%s@celforce.com',
'cellularone' => '%s@mycellone.net',
'eplus' => '%s@smsmail.eplus.de',
'tmobile_de' => '%s@t-mobile-sms.de',
'vodafone_de' => '%s@vodafone-sms.de',
* Identifies this driver.
* @return array Driver info.
'name' => _("Email-to-SMS Gateway"),
'desc' => _("This driver allows sending of messages through an email-to-SMS gateway, for carriers which provide this service.")
* Returns required parameters.
* @return array Array of required parameters.
'carrier' => array ('label' => _("Carrier"), 'type' => 'text'),
'mailBackend' => array ('label' => _("PEAR::Mail backend"), 'type' => 'text')
* You may also specify the carrier with the 'carrier' key of the message
* to avoid creating a new instance for each carrier, or fiddling with the
* @param array $message Message to send.
* @param string $to The recipient.
* @return array An array with the success status and additional
function _send($message, $to)
if (isset ($this->_params['carrier'])) {
$carrier = $this->_params['carrier'];
if (isset ($message['carrier'])) {
$carrier = $message['carrier'];
$dest = $this->_getDest ($to, $carrier);
$res = $this->mail->send ($dest, $this->_params['mailHeaders'], $message['text']);
if (PEAR ::isError ($res)) {
return array (0 , $res->getMessage ());
* Returns destination e-mail address.
* @param string $phone Phone number to send to.
* @return string Destination address.
function _getDest ($phone, $carrier)
if (!isset ($this->_carriers[$carrier])) {
throw new InvalidArgumentException ("Unknown carrier mapping: " . $carrier);
return sprintf($this->_carriers[$carrier],
* Returns the address template for a carrier.
* @param string $carrier Carrier name.
* @return mixed Address template or false.
if (!isset ($this->_carriers[$carrier])) {
return $this->_carriers[$carrier];
* Adds a carrier to the list.
* Address templates need to be in the form of an email address, with a
* '%s' representing the place where the destination phone number goes.
* @param string $name Carrier name.
* @param string $addr Address template.
$this->_carriers[$name] = $addr;
* Returns a list of parameters specific for this driver.
* @return array Default sending parameters.
Documentation generated on Mon, 11 Mar 2019 15:57:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|