CallXML 3.0 Development GuideHome  |  Frameset Home


<sendemail>  element

The 'sendemail' tag is a new addition to the CallXML arsenal. This tag allows you to programmatically send an email to a user specified destination. Additionally, this new element also allows you to output debugging information in the body of the email, which is a very useful 'watchdog' feature that allows you to be alerted via email, whenever errors are encountered within the application.


usage
<sendemail from="(email address)" subject="(email subject)" test="CDATA" to="(email address)" type="(debug|none)" value-is="STRING" value-is-not="STRING">


attributes
fromData Type: (email address)Default: Required
The 'from' attribute allows the developer to specify a return address for emails sent through the 'sendemail' element. Any valid email address is allowed, provided that it is parseable.
subjectData Type: (email subject)Default: Optional
The 'subject' attribute allows the developer to specify a subject line that will be visible to the email recipient.
testData Type: CDATADefault: Optional
The 'test' attribute is a new supplement to the CallXML markup that permits the developer to execute the contents of a container element, or action element, based on whether or not the specified condition is met. If the defined condition is met, then the code contained within the element is then executed. If the condition is not met, then the application resumes execution with the next sequential container container element in the document.
toData Type: (email address)Default: Required
The 'to' attribute allows the developer to specify a return address for emails sent through the 'sendemail' element. Any valid email address is allowed, provided that it is parseable.
typeData Type: (debug|none)Default: Optional
The 'type' attribute allows the developer to specify whether or not debugging output should be included in the message body of the email that is sent. Unless the setting of 'debug' is specified, the email will only contain the user data that is nested within the <sendemail> tags.
value-isData Type: STRINGDefault: none - attribute is optional
Another new attribute, 'value-is', grants the developer with the ability to perform conditional logic upon container elements, or action elements for the first time within the CallXML markup. The value specified in the 'value-is' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is' equate to 'true', then the element specified will execute. If the value equates to 'false' then the element will be skipped during document execution.
value-is-notData Type: STRINGDefault: none - attribute is optional
Another new attribute, 'value-is-not', grants the developer with the ability to perform conditional logic upon container elements, or action elements, for the first time within the CallXML markup. The value specified in the 'value-is-not' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is-not' equate to 'false', then the element specified will execute. If the value equates to 'true' then the element will be skipped during document execution.



code samples
<3.0 sendemail-from-to>
<?xml version="1.0" encoding="UTF-8" ?>


<callxml version="3.0">

  <block>
    <do>
      <playaudio value="Ingsoc.wav">
        <wait value="30s"/>
      </playaudio>

      <on event="hangup">
        <sendemail from="GeorgeOrwell@MinistryOfInformation.com"
                    to="WinstonSmith@Oceana.com">
              Received call from a comrade at $session.callerid; 
        </sendemail>

        <exit/>
      </on>

    </do>
  </block>
</callxml>

<3.0 sendemail debug>
<?xml version="1.0" encoding="UTF-8" ?>


<callxml version="3.0">

  <block>
    <do>
      <playaudio value="Ingsoc.wav" text="hello there jerky"/>

  <!-- WILL THIS THROW AN ERROR? -->
  <!-- YOU TELL ME...  -->

        <goto value="#BogusBlock"/>

        <on event="error">
        <sendemail from="Orwell@MinistryOfInformation.com" 
                      to="WinstonSmith@oceana.com" type="debug">
          Winston, we caught an error in our application. 
          Details follow...
        </sendemail>

      </on>


    </do>
  </block>
</callxml>


Debug Email Sample
----- Original Message -----
From: Orwell@MinistryOfInformation.com
Sent: Wednesday, May 18, 2005 2:43 PM
Subject: SendEmail from CallXML



We caught an error in our application.  Details follow...

=================================================================
Session Details
=================================================================

Date/Time                : 19:43:57 18/05/2005
Application ID            : 13565
Session ID                : ef70d3bd2da0ee62c88a01bafbea8497-75563
Current URL              : http://MyServer.com/MyApp.xml?session.ID=ef70d3bd2da0ee62c88a01bafbea8497-75563&session.callerid=1112223333&session.calledid=4445556666&callerID=4078350065&calledID=4445556666&session.accountid=000&session.applicationid=13565&session.outbounddialingflags=u&session.subaccountcode=&SubAccountCode=
Calling Number (ANI)      : 1112223333
Called Number (DNIS)      : 4445556666
Gateway Version          : 3.0.0.97
Last Error            : invalid target for goto or next attribute


=================================================================
CallXML Variables
=================================================================

session.ID = ef70d3bd2da0ee62c88a01bafbea8497-75563
sessionVarLock =
session.PrivateCallerID = false
session.RedirectedCalledID =
session.callerid = 1112223333
session.calledid = 4445556666
callerID = 1112223333
calledID = 4445556666
session.accountid = 000
session.applicationid = 13565
session.ttsdisplayname = English-Male1
session.outbounddialingflags = u
session.subaccountcode =
SubAccountCode =
session.LastError = invalid target for goto or next attribute

=================================================================
Current Document
=================================================================

<?xml version="1.0" encoding="UTF-8" ?>

<callxml version="3.0">

  <block>
    <block>
      <playaudio value="Ingsoc.wav" text="hello there jerky"/>

      <goto value="#BogusBlock"/>

        <onerror>
        <sendemail from="Orwell@MinistryOfInformation.com
to="WinstonSmith@oceana.com" type="debug">
          We caught an error in our application.  Details follow...
        </sendemail>
      </onerror>


    </block>
  </block>
</callxml>

--



<3.0 sendemail-test>
<?xml version="1.0" encoding="UTF-8" ?>

<callxml version="3.0">

  <block>
    <block>
      <playaudio value="Ayy_Oh.wav" text="hello there jerky"/>

  <!-- WILL THIS THROW AN ERROR? -->
  <!-- YOU TELL ME...  -->

        <goto value="#BogusBlock"/>

        <on event="error">

  <!-- this will not be executed, as '024' is not equal to '420' -->
        <sendemail from="tonydanza@whosetheboss.com" 
                      to="angela@whosetheboss.com"
                      test="420=024">
          Ayy, Oh, Angela. We caught an error in our application.
          Details follow...
        </sendemail>


  <!-- this will be executed, as '420' is equal to '420' -->
        <sendemail from="tonydanza@whosetheboss.com" 
                      to="angela@whosetheboss.com" type="debug"
                      test="420=420">
          Ayy, Oh, Angela.... We caught an error in our application.
          Details follow...
        </sendemail>


      </on>


    </block>
  </block>
</callxml>


<3.0 sendemail-valueis>
<?xml version="1.0" encoding="UTF-8" ?>

<callxml version="3.0">

  <block>
    <block value="danza">
      <playaudio value="Ayy_Oh.wav" text="A, Angela."/>

  <!-- WILL THIS THROW AN ERROR? -->
  <!-- YOU TELL ME...  -->

        <goto value="#BogusBlock"/>

        <on event="error">

  <!-- this will not be executed, as 'milano' is not equal to 'danza' -->
        <sendemail from="tonydanza@whosetheboss.com" 
                      to="angela@whosetheboss.com"
                      value-is="milano">
          Ayy, Oh, Angela. We caught an error in our application.
          Details follow...
        </sendemail>


  <!-- this will be executed, as 'danza' is equal to 'danza' -->
        <sendemail from="tonydanza@whosetheboss.com" 
                      to="angela@whosetheboss.com" type="debug"
                      value-is="danza">
          Ayy, Oh, Angela.... We caught an error in our application.
          Details follow...
        </sendemail>


      </on>


    </block>
  </block>
</callxml>




additional links
none


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login



© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site