Source for file generic_smtp.php
Documentation is available at generic_smtp.php
* Generic e-mail based SMS driver
* Copyright 2005 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.
* @author Ian Eure <ieure@php.net>
* Capabilities of this driver.
* @var array $capabilities
'att' => '%s@mobile.att.net',
'cingular' => '%s@mobile.mycingular.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' => _("EMail-to-SMS gateway driver, 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 Destination phone number.
* @return boolean True on success, PEAR_Error on failure.
function &_send (&$message, $to)
$destemail = $this->_getDest ($to);
$m = & Mail ::factory ($this->_params['mailBackend'], $this->_params['mailParams']);
if (isset ($message['carrier'])) {
$dest = $this->_getDest ($to, $message['carrier']);
$dest = $this->_getDest ($to);
$res = & $m->send ($dest, $this->_params['mailHeaders'], $message['text']);
if (PEAR ::isError ($res)) {
$response[$to] = array (false , $res->getMessage ());
$response[$to] = array (true , null );
* Returns destination e-mail address.
* @param string $phone Phone number to send to.
* @return string Destination address.
function _getDest ($phone, $carrier = null )
$carrier = is_null($carrier) ? $this->_params['carrier'] : $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;
Documentation generated on Mon, 11 Mar 2019 14:21:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|