Codestone Ltd logo

Command line SMTP client

Download

download CSSMTPSetup17.msi 252928 bytes Thu Jun 26 12:32:16 2008 BST Windows Installer


SMTP (RFC 821) Client

Feature rich command line SMTP client.
  • ESMTP authentication
  • Multiple Recipients (including CC and BCC Recipients)
  • Messages composed from multiple files (including stdin)
  • Mime Version 1.0 multipart/mixed content type messages
  • Files included in message body or as attachments
  • Automatic file type detection and encoding in 7bit, quoted-printable or base64 format
  • UUEncoding option

Usage:

CSSmtp[-b][-C<BCC recipients>][-c<CC recipients>][-f<files>]-h<host[:port]>[-l<charset>]-o<originator>[-q]-r<recipients>[-R<reply>]-s<subject>[-U][-u][-?] [-#] [-:<setname>] [-$]

Required Arguments:

-h<host> -o<originator> -r<recipients> -s<subject>

Summary:

SwitchDescription
-bWait for key on completion
-C<BCC recipients>Blind Copy Recipient addresses
-c<CC recipients>Copy Recipient addresses
-f<files>List of files to send
-h<host[:port]>SMTP Smart Host and optional port
-l<charset>MIME character set (default us-ascii)
-m<auth-method>ESMTP authentication method (PLAIN or LOGIN, default is PLAIN)
-n<username>ESMTP username
-o<originator>Message originator
-p<password>ESMTP password
-qQuiet mode - Send less diagnostics to stderr
-r<recipients>Recipient addresses
-R<reply>Reply-to address
-s<subject>Message subject
-UForce UUEncoding
-uUse UUEncoding
-#Display version number/About Box
-$Register the software

Notes

Connecting to a host

The host specified in the -h switch should be the DNS Name or IP Address of your SMTP server. In many cases that will be the server provided by your ISP- for example:

	CSSmtp -hmy.mail.server

Specifying the originator and subject

The -o switch should specify the email address, and optionally the name, of the originator (usually yourself) - for example:

	CSSmtp -hmy.mail.server -o"Fred Bloggs <[email protected]>"

Remember that Windows 95 and NT require that you put quotes around command line arguments which include spaces.

See the notes below for information on how to specify names and addresses.

The -R switch allows you to specify a different reply-to address.

The -s switch provides the subject of the message - for example:

	CSSmtp -hmy.mail.server -s"CSSMTP is a great program"

Watch those spaces again!

Specifying the recipients of the message

The -r, -c and -C switches specify the list of normal, CC and BCC recipients for the message. Each recipient address should be specified in the same format as the originator address and the addresses in the list should be separated with commas.

Specifying the body of the message

The -f switch should list a set of files which go to make up the body of the message.

The full path of each file should be specified and the files in the list should be separated with commas. By default the files will be included in the body of the message, if you wish the file to be a message attachment you should precede the name of the file with a plus sign:

	CSSmtp -fc:\docs\file1.txt,c:\docs\file2.txt,+c:\docs\file3.txt

The first two files are included in the body of the message, the third is included as an attachment.

You can specify stdin as a source of message text by including an empty filename in the list:

	dir | CSSmtp -fc:\docs\file1.txt,,+c:\docs\file3.txt

Puts file1.txt into the body of the message, then includes a directory listing, before attaching file3.txt to the message.

CSSMTP will automatically determine the correct encoding scheme to use for each file; either 7bit for normal text, quoted-printable for text including extended characters or base64 for binary files.

By default CSSMTP will use Mime Version 1.0 multipart/mixed content type messages to send the message. In some cases you may need to use UUEncoded messages for compatibility with legacy mail clients. The -u switch disables MIME Version 1.0 support and causes CSSMTP to send files as normal text, uuencoding them when necessary. The -U switch results in all files being UUEncoded, regardless of their content. If either the -u or -U switch is used then a '+' preceding any filename arguments will be ignored.

ESMTP authentication

CSSMTP can establish an authenticated connection with an ESMTP server using either the PLAIN or LOGIN authentication methods.

The -n and -p switches specify the ESMTP credentials. If either of these switches is included in the command line an ESMTP connection will be attempted with the given credentials:

	CSSmtp -hmy.mail.server -nEKrabappel -pseymour ... 

The default ESMTP authentication method is PLAIN; to specify LOGIN authentication you can use the -m switch:

	CSSmtp -hmy.mail.server -mLOGIN ... 

MIME Content-type charset value

The -l switch may be used to specify a specific value for the charset part of the MIME Content-type field, this allows language dependent character sets to be used - for example:

	CSSmtp -hmy.mail.server -lISO-8859-2

Uses the ISO-8859-2 character set.

If no value is specified the default, us-ascii, is used.

Specifying names and email addresses

Names and addresses used by the -o, -r, -c and -C may be specified in the following formats:
Full name and address - Fred Bloggs<[email protected]>
Just the email address - <[email protected]> or simply [email protected]

Exit ('ERRORLEVEL') codes

Symbol Value Notes
ERROR_NONE 0 The program exited successfully
ERROR_NO_ORIGINATOR 1 An originator must be specified, see the -o switch above
ERROR_NO_RECIPIENTS 2 A recipient must be specified, see the -r switch above
ERROR_NO_SUBJECT 3 A subject must be specified, see the -s switch above
ERROR_NO_HOST 4 A host must be specified, see the -h switch above
ERROR_ATACHING_FILE 5 The file could not be attached to the message, check it exists
ERROR_CONNECTING_TO_HOST 6 An error occurred while connecting to the host, check network connectivity, firewalls and the host name
ERROR_SENDING_MAIL 7 An error occurred while sending mail, check check network connectivity and firewalls
ERROR_INVALID_ESMTP_METHOD, 8 Only PLAIN and LOGIN may be specified for the -m switch
ERROR_AUTHENTICATING 9 The server returned an error while authenticating, check username, password and authentication method
ERROR_CLOSING_CONNECTION 10 The server returned an error while closing the connection, the server is probably broken

Revision History

ReleaseNotes
V01.7a
  • Added ERROR_AUTHENTICATING and ERROR_CLOSING_CONNECTION exit codes
  • Reduced the user rights required for normal operation
  • Added notes for the exit codes above
  • Compiled against VC7 rather then VC6
V01.6b
  • Specify an alternative port on the server
  • ESMTP PLAIN and LOGIN authentication
  • Issue with inline sections in MS Outlook resolved
V01.5a Build 221
  • Removed MFC42 dependencies.
V01.5a Build 211
  • Maintenance release. Reinstated exit ('ERRORLEVEL') codes. See Exit Codes above.
V01.5a
  • Now use the NT registry to lookup the content-type MIME field when including or attaching a file. Also derive the charset parameter from the current code page.
  • Tidied the formatting in MIME To and CC fields with multiple recipients.
  • Corrected the syntax of the QUIT command.
  • Maintenance revision of software key algorithms - Freeware and Trial Keys are no longer supported - software will expire after 30 days unless a registration key is purchased.
  • Stored default and named sets of parameters are not available in this release. They will be restored in version 1.6.
v01.0f
  • Fixed RFC 1341compliance problem with closing MIME encapsulation boundary. (Was missing trailing hyphens). Thanks to Jack O'Hare for reporting this problem
V01.0e
  • Library Maintenance revision - Fixed a problem with freeware keys and cleaned up some other routines.
V01.0d
  • Fixed problem affecting some 'To:' fields
V01.0c
  • Added -l switch to allow for language dependent MIME character sets
V01.0b
  • Fixed problem with files without CR/LF on last line
V01.0a
  • Initial release