Softabar Command Line Email Client

Copyright (c) 2005, 2009 Softabar (www.softabar.com)

Softabar Command Line Email Client, SCLEC, is a command line tool to access email.
Features include:

Usage

The installation is easy: just unzip the installation package to some directory. The installation package includes the SCLEC jar file with name "sclec-x.x.x.jar" where x.x.x is the current version number. The single jar file includes everything required to run SCLEC.
Requirement is Java runtime version 1.6.0 or later.

Usage:
java -jar sclec-x.x.x.jar [options] command [cmdopts ..] [command [cmdopts ..]] ..
or, for Windows systems, a cmd script sclec.cmd is provided:
sclec.cmd [options] command [cmdopts ..] [command [cmdopts ..]] ..

Command: java -jar sclec-x.x.x.jar --help shows command line options.

Samples

Sample commands how you can use SCLEC.

  1. View help and all available command line options.

    java -jar sclec-x.x.x.jar --help
  2. Install license file

    java -jar sclec-x.x.x.jar license -install=ORDERNBR.lic
  3. View installed license file

    java -jar sclec-x.x.x.jar license -view
  4. Verify given license file and execute command.

    java -jar sclec-x.x.x.jar license -verify=ORDERNBR.lic list -server=server.com -user=user -password=pwd
  5. Send simple mail with sender, recipient, subject and body.

    java -jar sclec-x.x.x.jar send -server=smtphostname -from="Matti Salo <msaloemail@somewhere.com>" -to=recipient@somewhereelse.org -subject="This is mail subject" -body="this is body"
  6. Send simple mail with sender, recipient, subject and body. Specify also SMTP server user name and password

    java -jar sclec-x.x.x.jar send -server=smtphostname -user=mailserveruser -password=12345 -from="Matti Salo <msaloemail@somewhere.com>" -to=recipient@somewhereelse.org -subject="This is mail subject" -body="this is body"
  7. Send simple mail with sender, recipient, subject and body with multiple lines of text.

    java -jar sclec-x.x.x.jar send -server=smtphostname -from="Matti Salo <msaloemail@somewhere.com>" -to=recipient@somewhereelse.org -subject="This is mail subject" -body="this is body line1" -body="this is body line2" -body="this is body line3"
  8. Send simple mail with SSL.

    java -jar sclec-x.x.x.jar send -server=smtphostname  -ssl -from="Matti Salo <msaloemail@somewhere.com>" -to=recipient@somewhereelse.org -subject="This is mail subject" -body="this is body line" 
  9. Send HTML mail and read HTML from a separate file.

    java -jar sclec-x.x.x.jar send -server=smtphostname  -html -from="Matti Salo <msaloemail@somewhere.com>" -to=recipient@somewhereelse.org -subject="This is mail subject" -bodyfile=c:/mails/mailbody.html
  10. Send simple mail and set importance to highest.

    java -jar sclec-x.x.x.jar send -server=smtphostname  -importance=HIGHEST -from="Matti Salo <msaloemail@somewhere.com>" -to=recipient@somewhereelse.org -subject="This is mail subject" -body="this is body line" 
  11. Send simple mail and attach a file and content of URL.

    java -jar sclec-x.x.x.jar send -server=smtphostname  -from="Matti Salo <msaloemail@somewhere.com>" -to=recipient@somewhereelse.org -subject="This is mail subject" -body="attachments" -attach=file.jpg -attach=http://server.host.name/images/image.jpg
  12. Send simple mails from CSV file. CSV-file format is TAB-separated fields of: to, cc, bcc, subject, body, bodyfile, attachment files. Use comma to separate entries within fields such as comma separated list of attachment files. Extra fields at the end of row, if present, are ignored.

    java -jar sclec-x.x.x.jar send -server=smtphostname  -from="Matti Salo <msaloemail@somewhere.com>" csv=mailstobesent.csv
  13. List mail in a users inbox using POP3.

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd 
  14. List mail in a user's inbox using IMAP.

    java -jar sclec-x.x.x.jar list -imap -server=mail.server.com -user=user -password=pwd 
  15. Display number of emails in user's inbox.

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -mailcount
  16. Read first email in a users inbox.

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -read=1
  17. Read all emails in a users inbox.

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -read=all
  18. Detach attachment in the first email in a users inbox.

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -read=1 -detach
  19. Save email as PDF.

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -read=1 -pdf
  20. Save email as PDF with specified file name.

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -read=1 -pdf=c:/temp/receivedmail.pdf
  21. List only the sender of email.

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -format=f
  22. List the sender and subject of emails.

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -format=fs
  23. List and save as CSV email date, sender and subject.

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -format=dfs -dateformat="yyyyMMdd-HH:mm:ss" -saveas=mails.csv
  24. List and save as CSV email date, sender and subject. Use semicolon as separator.

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -format=dfs -dateformat="yyyyMMdd-HH:mm:ss" -saveas=mails.csv -separator=;
  25. List mail where email sender is from somewhere.com

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -search="FROM CONTAINS somewhere.com"
  26. List mail where email sender includes somewhere.com or sender includes nowhere.com

    java -jar sclec-x.x.x.jar list -server=mail.server.com -user=user -password=pwd -search="FROM CONTAINS somewhere.com" -search="FROM CONTAINS nowhere.com" -or

Command line options

SCLEC/2.1.0 - Softabar Command Line Email Client
Copyright (c) 2005, 2009 Softabar (www.softabar.com)

Usage: java -jar sclec-2.1.0.jar [GLOBAL-OPTIONS] [CMD [CMD-OPTIONS] ...]

Global options:
  -help                                This help.
  -version                             Version information.
  -error-codes                         Show error codes for commands.
  -noheader                            Do not print header.
  -silent                              Do not print to system out.

Commands:
  license                              License handler.
      -install=FILENAME                Install license file.
      -uninstall                       Uninstall currently installed license
                                       file.
      -view                            View currently installed license.
      -verify=FILENAME                 Verify given license file.
  send                                 Send mail using SMTP.
      -server=HOSTNAME                 SMTP server host name.
      -serverport=PORT                 SMTP server port number. 
      -user=SMTPUSER                   SMTP server user name.
      -password=PASSWORD               SMTP server password.
      -from=EMAIL                      Sender address  (and optionally name
                                       specified as "SOME NAME
                                       ").
      -replyto=EMAIL                   Reply-to address  (and optionally name
                                       specified as "SOME NAME
                                       ").
      -to=EMAIL                        Recipient address  (and optionally
                                       name specified as "SOME NAME
                                       ").
      -cc=EMAIL                        CC recipient address  (and optionally
                                       name specified as "SOME NAME
                                       ").
      -bcc=EMAIL                       BCC recipient address  (and optionally
                                       name specified as "SOME NAME
                                       ").
      -subject=SUBJECT                 Email subject.
      -body=MSG                        Email body (message).
      -bodyfile=FILENAME               Read email body from file.
      -html                            Send email as HTML.
      -alt-body=MSG                    Plain text email body when sending
                                       HTML message.
      -tls                             Use TLS when sending mail.
      -ssl                             Use SSL when sending mail.
      -sslport=PORT                    SSL port number. If omitted, uses
                                       default port 465.
      -attach=FILENAME|URL             Attach file or URL content to email.
      -attach-del                      Delete attachment file(s) after
                                       sending. Use with attach option.
      -attach-zip                      ZIP attachment file(s) before sending.
      -attach-gzip                     GZIP attachment file(s) before sending.
      -csv=CSVFILENAME                 Read mails from a CSV-file that
                                       includes TAB-separated fields: to, cc,
                                       bcc, subject, body, bodyfile,
                                       attachment files. Use comma to
                                       separate entries within fields such as
                                       comma separated list of attachment
                                       files.
      -deletecsv                       Delete CSV-file after sending mails
      -header=NAME:VALUE               Add custom headers
      -importance=IMPORTANCE           Set mail importance. Allowed values
                                       are: [HIGHEST|HIGH|NORMAL|LOW|LOWEST]
      -debug                           Show debug info.
  list                                 List/read mail using POP3/IMAP.
      -server=HOSTNAME                 POP3/IMAP server host name.
      -serverport=PORT                 POP3/IMAP server port number. 
      -user=USERNAME                   POP3/IMAP server user name.
      -password=PASSWORD               POP3/IMAP server password.
      -imap                            Read mail from IMAP (v4) server. If
                                       omitted, default protocol is POP3.
      -ssl                             Use SSL (pop3s, imaps) when reading
                                       mail.
      -debug                           Show debug info.
      -folder=FOLDERNAME               Read mails from specified folder
                                       (INBOX by default). Use with IMAP.
      -indexes=STARTINDEX,ENDINDEX     List only mails from start index to
                                       end index (colon separated values like
                                       '1:10').
      -mailcount                       Display number of mails in specified
                                       folder.
      -count                           Display number of mails in result set
                                       (like search result).
      -readmessage=MESSAGESOURCEFILE   Read specified message. Message file
                                       must be email source.
      -read=MAILINDEX                  Read specified mail. If parameter
                                       omitted, reads latest mail. Use 'all'
                                       or '%' as index to read all mails.
      -view                            Read mail when listing mails (for
                                       example, search results).
      -detach                          Detach attachments to current dir or
                                       directory specified with --dir option.
                                       Use with --read option. If --read
                                       option is omitted it implies
                                       --read=all option to read all mails.
      -dir=DIRECTORY                   Detach attachments to specified
                                       directory.
      -source                          Print mail source. Use with --read
                                       option.
      -headers                         Print only mail headers. Use with
                                       --read option.
      -delete                          Delete message. Use with --read option.
      -noconfirm                       Do not confirm delete. Use with --read
                                       and --delete options.
      -partinfo                        Print multipart info from mail body
                                       parts. Use with --read option.
      -pdf=PDFFILENAME                 Print file as PDF. If parameter
                                       omitted, file name is generated from
                                       sender address and sent date.
      -search=SEARCHPATTERN            Search mail using following syntax:
                                       [[!]SUBJECT CONTAINS ] |
                                       [[!]SUBJECT CONTAINS ]
                                       |[[!]BODY CONTAINS ] |[[!]FROM
                                       [CONTAINS | EQ] ] |[[!]TO EQ
                                       ] |[[!]CC EQ ]
                                       |[[!]SENTDATE [LE | GE | GT | LT | NE
                                       | EQ] ]  Use multiple search
                                       options to compine search terms.
                                       Default operator is AND. Use -or
                                       option for OR operator.
      -or                              Use OR operator when multiple search
                                       options are present. Default is AND
                                       operator.
      -format=FORMATSTRING             Custom format when listing mail.
                                       Format options are: 1=message
                                       number;s=subject;f=from
                                       address;F=sender address;d=sent date
                                       (use -dateformat option to
                                       customize);b=message body;B=message
                                       body where linefeed, tab and carriage
                                       return are replace by space;c=CC
                                       recipients;t=TO recipients;r=reply-to
                                       address;z=message size;a=attachment
                                       file names;I=message id;M=mailer;H=all
                                       message headers;S=email source
      -dateformat=DATEFORMAT           Custom date format when listing mail.
                                       Format may include: yy | yyyy = year;
                                       MM | MMM = month; dd = day in month;
                                       DD = day in year; HH = hour in day
                                       (0-23); hh = hour in am/pm (1-12); mm
                                       = minute in hour; ss = second in
                                       minute; SSS = millisecond; w = week in
                                       year; w = week in year; W = week in
                                       month; a = am/pm marker; z | Z | zzzz
                                       = time zone. 
      -separator=STR                   Custom field separator when listing
                                       mails. Default is comma (,).
      -quotechar=STR                   Custom field quote character when
                                       listing mails. Default is none.
      -saveas=FILENAME                 Save mails when listing mail. Use
                                       format-option to modify output format,
                                       for example, CSV file. 
      -append                          Append mails to existing file. Use
                                       with saveas-option.