ColdFusion Fax – Send Plain-Text Message Using SendCharFax

The SendCharFax method allows you to send a basic, plain-text fax from ColdFusion. Text is limited to be standard ASCII (no 8-bit characters), but can include HTML markup.

Using HTML causes automatic word wrapping, whereas regular text does not.

This ColdFusion fax sample submits a plain-text file to the Web service, and indicates whether the submission succeeded. The return value of a successful submission is the transaction ID (positive number) of the fax in the system. Other return values indicate a failure (for more details, see Web Service Return Codes).


<!--- Username and password for the Interfax account. --->
<cfset interfaxUsername = "">
<cfset interfaxPassword = "">

      Fax number where the message is to be sent.
    For the format of the fax number please see:
<cfset faxNumber = "">

<!--- The plain text content of the fax goes here --->
<cfsavecontent variable="faxMessage">
Your fax content goes here.

<!--- Create and call the web service --->
<cfset faxWebService = CreateObject("webservice", "")>

<cfset faxID = faxWebService.SendCharFax(interfaxUsername, interfaxPassword, faxNumber, faxMessage, "TXT")>

<!--- Check to see if the fax was sent ok. --->
<cfif faxID gt 0>
    Fax submitted ok. Transaction ID: #faxID#
    Error submitting fax.
    Return code: #faxID#.<br>
    Error message:  #faxID#