Product Logo

SMTPit Pro

A Feature-rich Email plug-in

Functions

SMTPit_File_Write

NameSMTPit_File_Write
Description

Writes data out to a file.

Return TypeText
FormatSMTPit_File_Write ( Data ; File ; FileExistsAction ; CharacterSet ; LineEndingType ; IncludeUnicodeBOM )
Required Parameters
Data

The data to write.

File

The path and file name of the file to write.

Optional Parameters
FileExistsAction

Defines what happens if the file already exists. Specify “Abort” to abort the function. [This is the default.] Specify “Overwrite” to overwrite the file. Specify “Backup” to backup the existing file before creating a new version. Specify “Append” to append the new data to the end of the existing file. Specify “Unique” to create a new file with a unique file name to write the data to.

CharacterSet

The character set for the file. [Default is UTF-8.]

LineEndingType

The type of line endings to use. Specify “System” to use the correct line endings for the system. [This is the default.] Specify “Mac” for Macintosh stlye CR line endings. Specify “Win” for Windows style CRLF line endings. Specify “Unix” for Unix style LF line endings. Specify “None” to not modify the line endings.

IncludeUnicodeBOM

If True, and the character set is a unicode set, and the file is being created, this will include a unicode byte order mark. [Default is False.]

Examples
Example 1

Writes the data "My Data" to the "Data.txt" file.

SMTPit_File_Write ( "My Data" ; "~/Desktop/Data.txt" )
Example 2

Writes the data "My Data" to the "Data.txt" file and overwrites the file if it already exists.

SMTPit_File_Write ( "My Data" ; "C:\Users\Bob\Desktop\Data.txt" ; "Overwrite" )
Example 3

Creates a new "Data.txt" file with the data "My Data" in it and backs up the existing "Data.txt" file. It also writes a unicode BOM to the file.

SMTPit_File_Write ( "My Data" ; "~/Desktop/Data.txt" ; "Backup" ; "" ; "" ; True )