Python Fax - Send Plain-Text Message Using SendCharFax

Download the Python fax code samples and library.

This sample demonstrates how to send a basic, plain-text fax from Python, using the SendCharFax method. 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.

The following Python fax snippet 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).

"""
A simple script to send an ASCII fax the InterFAX  
SendCharFax SOAP API call.
"""
from interfax import client
 
print 'Testing SendCharFax...'
c = client.InterFaxClient('USERNAME','PASSWORD') # Enter your Interfax username/password here
result = c.sendCharFax('+12125554874', 'This is a test') # Enter the destination fax number here.
print '   Char Fax was sent with result code: %d' % result
 
"""
In case of successful submission, result will contain a positive 
Transaction ID.
 
A negative value means an error occurred.
See the InterFax Status Codes: http://www.interfax.net/en/dev/webservice/reference/web-service-return-codes
"""