ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBMFTransport_SMTP Class Reference
+ Inheritance diagram for ilBMFTransport_SMTP:
+ Collaboration diagram for ilBMFTransport_SMTP:

Public Member Functions

 ilBMFTransport_SMTP ($URL, $encoding='US-ASCII')
 ilBMFTransport_SMTP Constructor
 send ($msg, $options=array())
 Sends and receives SOAP data.
 setCredentials ($username, $password)
 Sets data for HTTP authentication, creates Authorization header.
 _validateUrl ()
 Validates url data passed to constructor.
- Public Member Functions inherited from ilBMFBase
 ilBMFBase ($faultcode= 'Client')
 Constructor.
 _resetNamespaces ()
 _setSchemaVersion ($schemaVersion)
 Sets the schema version used in the SOAP message.
 _getNamespacePrefix ($ns)
 _getNamespaceForPrefix ($prefix)
 _isSoapValue (&$value)
 _serializeValue (&$value, $name= '', $type=false, $elNamespace=NULL, $typeNamespace=NULL, $options=array(), $attributes=array(), $artype='', $OBJTypeNS=array())
 _getType (&$value)
 Converts a PHP type to a SOAP type.
 _multiArrayType (&$value, &$type, &$size, &$xml)
 _isBase64 (&$value)
 Returns whether a string is base64 encoded data.
 _isBase64Type ($type)
 Returns whether a type is a base64 type.
 _isHash (&$a)
 Returns whether an array is a hash.
 _un_htmlentities ($string)
_decode (&$soapval)
 _makeEnvelope (&$method, &$headers, $encoding=SOAP_DEFAULT_ENCODING, $options=array())
 Creates the SOAP envelope with the SOAP envelop data.
 _makeMimeMessage (&$xml, $encoding=SOAP_DEFAULT_ENCODING)
 _makeDIMEMessage ($xml)
 _decodeMimeMessage (&$data, &$headers, &$attachments)
 _decodeDIMEMessage (&$data, &$headers, &$attachments)
 __set_type_translation ($type, $class=null)
- Public Member Functions inherited from ilBMFBase_Object
 ilBMFBase_Object ($faultcode= 'Client')
 Constructor.
_raiseSoapFault ($str, $detail= '', $actorURI= '', $code=null, $mode=null, $options=null, $skipmsg=false)
 Raises a SOAP error.
 __isfault ()
__getfault ()
 _debug ($string)
 Adds a string to the debug data.
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor.
 _PEAR ()
 Destructor (the emulated type of...).
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them.
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes.
 isError ($data, $code=null)
 Tell whether a value is a PEAR error.
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled.
 expectError ($code= '*')
 This method is used to tell which errors you expect to get.
 popExpect ()
 This method pops one element off the expected error codes stack.
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available.
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack.
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied.
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options.
 staticPushErrorHandling ($mode, $options=null)
 staticPopErrorHandling ()
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack.
 popErrorHandling ()
 Pop the last error handler used.
 loadExtension ($ext)
 OS independant PHP extension load.

Data Fields

 $credentials = ''
 $timeout = 4
 $urlparts = NULL
 $url = ''
 $incoming_payload = ''
 $_userAgent = SOAP_LIBRARY_NAME
 $encoding = SOAP_DEFAULT_ENCODING
 $host = '127.0.0.1'
 $port = 25
 $auth = NULL
- Data Fields inherited from ilBMFBase
 $_XMLSchema
 $_XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 $_typemap
 $_defaultObjectClassname = 'stdClass'
 Default class name to use for decoded response objects.
 $_namespaces
 $_namespace
 $_xmlEntities
 $_doconversion = false
 $__attachments = array()
 $_wsdl = null
 $_section5 = true
 True if we use section 5 encoding, or false if this is literal.
 $_auto_translation = false
 $_type_translation = array()
- Data Fields inherited from ilBMFBase_Object
 $_debug_flag = false
 Store debugging information in $_debug_data?
 $_debug_data = ''
 String containing debugging information if $_debug_flag is true.
 $_encodings = array('ISO-8859-1', 'US-ASCII', 'UTF-8')
 Supported encodings, limited by XML extension.
 $_myfaultcode = ''
 Fault code.
 $fault = null
 Recent PEAR_Error object.
- Data Fields inherited from PEAR
 $_debug = false
 $_default_error_mode = null
 $_default_error_options = null
 $_default_error_handler = ''
 $_error_class = 'PEAR_Error'
 $_expected_errors = array()

Detailed Description

Definition at line 44 of file class.ilBMFTransport_SMTP.php.

Member Function Documentation

ilBMFTransport_SMTP::_validateUrl ( )

Validates url data passed to constructor.

Returns
boolean private

Definition at line 191 of file class.ilBMFTransport_SMTP.php.

References ilBMFBase_Object\_raiseSoapFault().

Referenced by send().

{
if (!is_array($this->urlparts)) {
$this->_raiseSoapFault("Unable to parse URL $url");
return false;
}
if (!isset($this->urlparts['scheme']) ||
strcasecmp($this->urlparts['scheme'], 'mailto') != 0) {
$this->_raiseSoapFault("Unable to parse URL $url");
return false;
}
if (!isset($this->urlparts['path'])) {
$this->_raiseSoapFault("Unable to parse URL $url");
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBMFTransport_SMTP::ilBMFTransport_SMTP (   $URL,
  $encoding = 'US-ASCII' 
)

ilBMFTransport_SMTP Constructor

Parameters
string$URLmailto:address

public

Definition at line 64 of file class.ilBMFTransport_SMTP.php.

References $encoding, and ilBMFBase\ilBMFBase().

{
$this->encoding = $encoding;
$this->urlparts = @parse_url($URL);
$this->url = $URL;
}

+ Here is the call graph for this function:

ilBMFTransport_SMTP::send (   $msg,
  $options = array() 
)

Sends and receives SOAP data.

Parameters
string$msgOutgoing POST data.
string$actionSOAP Action header data.
integer$timeoutSocket timeout, defaults to 0 or off.
Returns
string Response data, minus HTTP headers. public

Definition at line 82 of file class.ilBMFTransport_SMTP.php.

References $_userAgent, ilBMFBase_Object\$fault, $host, $incoming_payload, $namespace, $out, $result, ilBMFBase\_makeEnvelope(), ilBMFBase_Object\_raiseSoapFault(), _validateUrl(), and PEAR\isError().

{
$this->incoming_payload = '';
$this->outgoing_payload = $msg;
if (!$this->_validateUrl()) {
return $this->fault;
}
if (!$options || !isset($options['from'])) {
return $this->_raiseSoapFault('No From: address to send message with');
}
if (isset($options['host'])) $this->host = $options['host'];
if (isset($options['port'])) $this->port = $options['port'];
if (isset($options['auth'])) $this->auth = $options['auth'];
if (isset($options['username'])) $this->username = $options['username'];
if (isset($options['password'])) $this->password = $options['password'];
$headers = array();
$headers['From'] = $options['from'];
$headers['X-Mailer'] = $this->_userAgent;
$headers['MIME-Version'] = '1.0';
$headers['Message-ID'] = md5(time()) . '.soap@' . $this->host;
$headers['To'] = $this->urlparts['path'];
if (isset($options['soapaction'])) {
$headers['Soapaction'] = "\"{$options['soapaction']}\"";
}
if (isset($options['headers']))
$headers = array_merge($headers, $options['headers']);
// If the content type is already set, we assume that MIME encoding is
// already done.
if (isset($headers['Content-Type'])) {
$out = $msg;
} else {
// Do a simple inline MIME encoding.
$headers['Content-Disposition'] = 'inline';
$headers['Content-Type'] = "text/xml; charset=\"$this->encoding\"";
if (isset($options['transfer-encoding'])) {
if (strcasecmp($options['transfer-encoding'], 'quoted-printable') == 0) {
$headers['Content-Transfer-Encoding'] = $options['transfer-encoding'];
$out = $msg;
} elseif (strcasecmp($options['transfer-encoding'],'base64') == 0) {
$headers['Content-Transfer-Encoding'] = 'base64';
$out = chunk_split(base64_encode($msg), 76, "\n");
} else {
return $this->_raiseSoapFault("Invalid Transfer Encoding: {$options['transfer-encoding']}");
}
} else {
// Default to base64.
$headers['Content-Transfer-Encoding'] = 'base64';
$out = chunk_split(base64_encode($msg));
}
}
$headers['Subject'] = isset($options['subject']) ? $options['subject'] : 'SOAP Message';
foreach ($headers as $key => $value) {
$header_text .= "$key: $value\n";
}
$this->outgoing_payload = $header_text . "\r\n" . $this->outgoing_payload;
$mailer_params = array(
'host' => $this->host,
'port' => $this->port,
'username' => $this->username,
'password' => $this->password,
'auth' => $this->auth
);
$mailer =& new Mail_smtp($mailer_params);
$result = $mailer->send($this->urlparts['path'], $headers, $out);
$val =& new ilBMFValue('Message-ID', 'string', $headers['Message-ID']);
} else {
$sval[] =& new ilBMFValue('faultcode', 'QName', 'SOAP-ENV:Client');
$sval[] =& new ilBMFValue('faultstring', 'string', "couldn't send SMTP message to {$this->urlparts['path']}");
$val =& new ilBMFValue('Fault', 'Struct', $sval);
}
$mqname =& new QName($method, $namespace);
$methodValue =& new ilBMFValue('Response', 'Struct', array($val));
$this->incoming_payload = $this->_makeEnvelope($methodValue,
$this->headers,
$this->encoding);
}

+ Here is the call graph for this function:

ilBMFTransport_SMTP::setCredentials (   $username,
  $password 
)

Sets data for HTTP authentication, creates Authorization header.

Parameters
string$usernameUsername.
string$passwordResponse data, minus HTTP headers.

public

Definition at line 179 of file class.ilBMFTransport_SMTP.php.

{
$this->username = $username;
$this->password = $password;
}

Field Documentation

ilBMFTransport_SMTP::$_userAgent = SOAP_LIBRARY_NAME

Definition at line 52 of file class.ilBMFTransport_SMTP.php.

Referenced by send().

ilBMFTransport_SMTP::$auth = NULL

Definition at line 56 of file class.ilBMFTransport_SMTP.php.

ilBMFTransport_SMTP::$credentials = ''

Definition at line 47 of file class.ilBMFTransport_SMTP.php.

ilBMFTransport_SMTP::$encoding = SOAP_DEFAULT_ENCODING

Definition at line 53 of file class.ilBMFTransport_SMTP.php.

Referenced by ilBMFTransport_SMTP().

ilBMFTransport_SMTP::$host = '127.0.0.1'

Definition at line 54 of file class.ilBMFTransport_SMTP.php.

Referenced by send().

ilBMFTransport_SMTP::$incoming_payload = ''

Definition at line 51 of file class.ilBMFTransport_SMTP.php.

Referenced by send().

ilBMFTransport_SMTP::$port = 25

Definition at line 55 of file class.ilBMFTransport_SMTP.php.

ilBMFTransport_SMTP::$timeout = 4

Definition at line 48 of file class.ilBMFTransport_SMTP.php.

ilBMFTransport_SMTP::$url = ''

Definition at line 50 of file class.ilBMFTransport_SMTP.php.

ilBMFTransport_SMTP::$urlparts = NULL

Definition at line 49 of file class.ilBMFTransport_SMTP.php.


The documentation for this class was generated from the following file: