• Errors and warnings in CMD mode
  • Sample batchfile with ErrorLevel in use
  • By Frans Wauters




    Download 41,13 Kb.
    Sana26.12.2019
    Hajmi41,13 Kb.
    #5234

    SMTPsend © 2002 by Frans Wauters

    SMTPsend is a tool to send mail without an email client installation.

    This tool works with command-line arguments what makes it ideal for batch routines, but now you can use a GUI interface to send a mail or create a script to automate sending parameters.
    Usage:
    SMTPsend server -t"To" -c"Cc" -h"Bcc" -s"Subject" -b"Body" -f"From" -a"Attachment"

    Parameters:
    Server SMTP (relay)server or IP-Address
    -t”To” Destination address (*)

    -c”Cc” Copy Concatenate Destination (*)

    -h”Bcc” Blind Copy Concatenate Destination (*)
    -f”From” Transmitter of this email
    -s”Subject” Subject of the email

    -b”Body” Body or a filename containing the body

    -a”Attachment(s)” Filename(s) (*)
    -n | +n Disable or enable logging
    script=”Filename” Using a script with the parameters to send
    (*) For multiple addresses or filenames use an ";" as separator.

    Logging:
    A logfile called SMTPsend.log can be found in the same directory as the SMTPsend program.

    This is usually to find in the windows directory.



    Required:
    Required parameters:
    Server address

    One (min. 1) destination address (-t”To”, -c”Cc” or –h”Bcc”)



    Example:
    As command-line sample:
    SMTPsend smtp.myisp.com –t”info@company.com” –s”Sample mail” –b”body.txt”
    OR in batch (sample):
    SET SMTP=smtp.myisp.com

    SET SUBJECT=Backup process

    SET BODY=See attachment for backup logs

    SET ATT=Server1.log;Server2.log;Server3.log

    SET FROM=Backup@acme.com

    SET TO=ICT@acme.com



    SMTPsend %SMTP% -s”%SUBJECT%” –b”%BODY%” –a”%ATT%” –f”%FROM%” –t”%TO%”
    Installation:


    • Please de-install the previous when this occurs in the software list in the control panel’s “software” shortcut before installing this new version

    • This version will install the program in the standard windows directory so the program will be available from any directory because the directory is included in the search PATH variable



    De-installation:


    • If you are using a version equal to 1.11 or higher, you can de-install this software by using the software icon in the control panel.

    • For the older versions you can delete the CAVO20NT.DLL, CAVO20RT.DLL and SMTPSEND.* files if they are on your disk. The old versions does not use an installer/de-installer.



    History:
    Version 1.00


    • First working version

    • Tested with several smtp and relay servers (ISP related)

    Version 1.10




    • Added the –h”Bcc” option for a Blind Copy Concatenated destination address

    • When the body is a valid filename, the content is used as the body text

    • Added the /? to display the command-line syntax

    • Tested with several smtp and relay servers (ISP related)

    Version 1.11




    • Fixed a V0 2.5 bug for sending large attachments

    • Version() function

    • Adding some logging functionality (in same directory as the executable)

    • Setup program for installing SMTPsend and to make a de-install possible trough the control panel: “software” shortcut

    • Tested with several smtp and relay servers (ISP related)

    • Tested with Microsoft Exchange 5.5 server (by using a vailid emailaddress for your domain for the From-parameter)

    Version 1.20




    • GUI functionality when starting the executable without any command-line parameters

    • Script functionality because the limited command-line size

    • Enhanced and configurable log-functionality

    • Saves some settings in the registry (ex. Smtp server) through GUI window after send

    Version 1.21




    • GUI - Checkboxes to indicate the values to save in the registry

    • GUI - Checkbox to close the application (or not) when a send operation was successful

    • GUI - Solved a problem with the hourglass after a send failure

    • GUI - Open the logfile fixed when the .LOG extention was not bind to an application

    • GUI - Errorboxes to cummunicate problems (See ErrorLevel in CMD mode)

    • CMD - Added ERRORLEVEL functionality


    Errors and warnings in CMD mode

    when SMTPsend (1.21+) is used on the commandline :


    ERRORLEVEL Description


    1. Send successfull

    2. Send successful but an attachment problem (warning)

    3. Send failure

    4. Send failure and an attachment problem

    5. Server/IP-Address not found

    6. No destination address specified


    Sample batchfile with ErrorLevel in use

    @ECHO OFF

    CLS
    rem A parameterscript can be created trough the GUI interface
    smtpsend script=filename.txt
    IF Errorlevel 5 GOTO Err5

    IF Errorlevel 4 GOTO Err4

    IF Errorlevel 3 GOTO Err3

    IF Errorlevel 2 GOTO Err2

    IF Errorlevel 1 GOTO War1

    IF Errorlevel 0 GOTO Suc0

    GOTO Exit
    :Err5

    ECHO (%Errorlevel%) No destination address specified

    GOTO Exit
    :Err4

    ECHO (Error %Errorlevel%) Server/IP-Address not found

    GOTO Exit
    :Err3

    ECHO (Error %Errorlevel%) Attachment and Send failure

    GOTO Exit
    :Err2

    ECHO (Error %Errorlevel%) Send failure

    GOTO Exit
    :War1

    ECHO (Warning %Errorlevel%) Attachment Warning, Send OK

    GOTO Exit
    :Suc0

    ECHO (Success %Errorlevel%) Send OK



    GOTO Exit
    :Exit

    Future enhancements:
    Version 2.00


    • Option to authenticate to the smtpserver (if needed)



    Note:
    It was not indenting to make an email client, but just a tool to make life easier for IT support or freaky command-line users.
    Download 41,13 Kb.




    Download 41,13 Kb.