SMTPHandler encapsulates all the functionality necessary to send files through an SMTP server.
This concept is able to connect and send message to SMTP server.
URL format is :
smtp://<hostName>/
Possible options :
-
user
- use this option to specify userName for SMTP server connection.
-
pwd
- use this option to specify passwd for SMTP server connection.
This example get a message form POP3 server and
send it to SMTP server.
$x from "pop3://hostName/retrieve?id=ID" options "user"="userName","pwd"="passwd"
$x to "smtp://hostName/"
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI |
|
Methods inherited from: URIHandler
|
Parameters: |
$url : | The url with which this SMTPHandler will be created. |
|
Creates a new SMTPHandler concept with the given $url.
Parameters: |
$uri : | The uri which will be tested if it is acceptable by this handler. |
|
Returns true if the given $uri is acceptable by this handler, false
otherwise.
print SMTPHandler.acceptsURI("smtp://server")
-- the result is --
true
Returns true if the closing of this connection was successfull, false
otherwise.
$msg FROM "pop3://crow:crowp@server/"
$url = "smtp://server/"
$smtp = SMTPHandler.create( $url )
if $smtp.acceptsURI( $url ) then [
$m typeof Map
if ( $smtp.initialize( $m ) ) then [
if ( $smtp.openConnection ) then [
print "Message sent:" + $smtp.setContent( $msg/1.toTXT )
$smtp.closeConnection
]
]
]
-- the result is --
Message sent: true
Return false.
Parameters: |
$options : |
Contains a filter with which the returned content will be filtered. |
|
Returns true if the SMTPHandler was initilized successfully, false
otherwise.
$msg FROM "pop3://crow:crowp@server/"
$url = "smtp://server/"
$smtp = SMTPHandler.create( $url )
if $smtp.acceptsURI( $url ) then [
$m typeof Map
if ( $smtp.initialize( $m ) ) then [
if ( $smtp.openConnection ) then [
print "Message sent:" + $smtp.setContent( $msg/1.toTXT )
$smtp.closeConnection
]
]
]
-- the result is --
Message sent: true
Exceptions: |
connectionException :
(Error) | If the SMTP server refuzed connection or log on failed. |
badURLException :
(Error) | If the URL is not valid.. |
Returns true if the connection can be establised with the remote server
from this concept's url, false otherwise.
$msg FROM "pop3://crow:crowp@server/"
$url = "smtp://server/"
$smtp = SMTPHandler.create( $url )
if $smtp.acceptsURI( $url ) then [
$m typeof Map
if ( $smtp.initialize( $m ) ) then [
if ( $smtp.openConnection ) then [
print "Message sent:" + $smtp.setContent( $msg/1.toTXT )
$smtp.closeConnection
]
]
]
-- the result is --
Message sent: true
Parameters: |
$value : | The value to be set. |
|
Exceptions: |
sendException :
(Error) | If unable to send message to SMTP server. |
Sets this SMTPHandler content to the specified $value.
$msg FROM "pop3://crow:crowp@server/"
$url = "smtp://server/"
$smtp = SMTPHandler.create( $url )
if $smtp.acceptsURI( $url ) then [
$m typeof Map
if ( $smtp.initialize( $m ) ) then [
if ( $smtp.openConnection ) then [
print "Message sent:" + $smtp.setContent( $msg/1.toTXT )
$smtp.closeConnection
]
]
]
-- the result is --
Message sent: true