Fax ASP Classic – Send a Basic, Plain-Text Fax Using SendCharFax

The SendCharFax method used in this example sends a basic, plain-text fax with ASP (text is limited to be standard ASCII, meaning no 8-bit characters, but can include HTML). Note that using HTML causes automatic word wrapping, whereas regular text does not.

The fax ASP sample below submits a plain-text file 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).



<%
'
' The simplest method for sending a fax.
' Use to send textual document formats, such as Text or html.
'
Option Explicit
%><%

Dim objEnv
Dim objHttp

Set objEnv = Server.CreateObject("PocketSOAP.Envelope")

objEnv.EncodingStyle = ""

objEnv.SetMethod "SendCharFax", "http://www.interfax.cc"
objEnv.Parameters.Create "Username", Username, objEnv.URI
objEnv.Parameters.Create "Password", Password, objEnv.URI
objEnv.Parameters.Create "FaxNumber", "+12125555555", objEnv.URI
objEnv.Parameters.Create "Data", "Hello world!", objEnv.URI
objEnv.Parameters.Create "FileType", "txt", objEnv.URI

Set objHttp = Server.CreateObject("PocketSOAP.HTTPTransport")
objHttp.SoapAction = "http://www.interfax.cc/SendCharFax"
objHttp.Send "https://ws.interfax.net/DFS.asmx", objEnv.Serialize
objEnv.parse objHttp

Dim SendResult
SendResult = objEnv.Parameters.Item(0).Value

If SendResult < 0 Then
    response.write ("Bad status=" & SendResult)
Else
    response.write ("Fax properly sent; TransactionID: " & SendResult)
End If

Set objEnv = Nothing
Set objHttp = Nothing
%>