@MinDoc(copyright="Copyright 2002 - 2004 , 2009 A. Weinert", author="Albrecht Weinert", version="V.44", lastModified="6.05.2021", usage="start as Java application (-? for help)", purpose="a tiny E-mail sender (command line controlled)") public class SendMail extends App
javax.mail
).BodyPart
) and / or one or more file attachments
(Multipart
) to one or more addressees.From : the cheap provider <dev.executive@sioux.tv> To : the customer <dear.customer@customers-ltd.tv> Reply-To: call centre <pontius.pilatus@sioux.tv> Subject : You are disconnected after your Western Union payment This mail was only send to you to keep you calm. You should get the impression your error report is taken seriously and the repair is under way. But this is just an automated response by a clever computer programme. Thank you for your endless patience.On such RFC822 mail definitions the very first empty line is the separation of the header definitions from the (optional) mail text.
SendMail
in the anonymous package.# Property-File for SendMail.java (jdk\jre\lib\SendMail.properties) # V1.0 (So, 04.04.2010, 21:57 MEZ) # for location / server: @ home # A. Weinert changes for 1&1 # mail.from= no.reply@frame4j.de mail.smtp.host = smtp.1und1.de userName= ano.reply@frame4j.de # use the next line if you like it here more than in the command line # userPass=monRepos proxySet = false mail.smtp.auth = true # if behind a proxy say: # proxySet = true # proxyHost = myCompany'sProxy # proxyPort = 8080
InternetAddress
,
MimeMessage
ComVar.Impl
Modifier and Type | Field and Description |
---|---|
String |
attach
First attachment file.
|
String |
bcc
The secret copy recipient(s) (may be a list).
|
String |
cc
The copy recipient(s) (may be a list).
|
String |
contFile
The content file.
|
String |
contFileEncoding
File encoding for content file.
|
int |
contLogLength
Log length of content.
|
boolean |
parse
The file is not only the content.
|
String |
proxyHost
The proxy server's name.
|
String |
proxyPort
The proxy server's port.
|
boolean |
proxySet
Use a proxy server connecting to mail host.
|
String |
subject
The subject.
|
String |
text
The content.
|
String |
timeFormat
Format for time stamp.
|
boolean |
timeStamp
Set actual time stamp.
|
String |
to
The recipient(s) (may be a list).
|
String |
userName |
String |
userPass |
ano, appBase, appIO, appStartTime, appStartTimeMS, args, argsOrig, bgColor, err, fullClassName, help, icon, log, mainThread, myClass, myFrame, name, out, outMode, packName, prop, retCode, runFlag, shortClassName, title, verbose, verbosity
AUTHOR, BLANK_STRING, cons, CONSOL_ENCODING, COPYRIGHT, D, D_NaN, D_NegInf, D_PosInf, EMPTY_INT_A, EMPTY_STRING, FILE_ENCODING, FRW_CLLD, FS, FSS, H, hasCons, HOST_IP, HOST_IPv4, HOST_NAME, INIT_ERROR, JAR_ENCODING, JH, JOB_DONE_OK, JRL, LOG_OUT_ERROR, M, MAIN_THREAD_EXC, NO_BYTES, NO_CLASSES, NO_DOUBLES, NO_OBJECTS, NO_PARS_ERROR, NO_STRINGS, NOT_WINDOWS, ON_PI, ONE_DAY, ONE_HOUR, ONE_LEAP_YEAR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, ONE_YEAR, OS, PROG_NAME, PROG_SHORT, PS, RUNTIME, S, SHY, UD, UL, UL_UR_da, UR
ILLEGAL_TYPE, ILLEGAL_VALUE, NO_ATTRIBUTE, NO_KNOWN_ATTRIBUTE, NO_VALUE, OK, retVtext
Modifier and Type | Method and Description |
---|---|
int |
doIt()
Working method of SendMail.
|
static void |
main(String[] args)
Start method of SendMail.
|
actionPerformed, allowNoPropertiesFile, clientOrder, condHelpLog, connect, errMeld, errMeld, errorExit, errorExit, errorText, extraPropertiesFile, formMessage, formMessage, formMessage, getAbout, getAboutText, getActTime, getAppLogger, getAppStartTime, getArgs, getAuthor, getCopyright, getDbLogger, getExecTimeMs, getExecTimeMsL, getExecTimeString, getHelp, getHelpText, getIcon, getLanguage, getLogHandler, getMessageComponent, getMessageComponentsLength, getMyFrame, getName, getNameWithVersDate, getOutMode, getProp, getPurpose, getStartTime, getStateString, getTheCloser, getTitle, getUsage, getVerbose, getVerbosity, getVersDate, go, go, go, haveIcon, isDebug, isHelp, isHelpLog, isNormal, isRunFlag, isSilent, isTest, isVerbose, logVerbose, logVerbose, makeStatusTextEnd, makeStatusTextStart, messageFormat, normalExit, parsePartial, performeAction, queueAction, regAsStdMBean, repExc, setAboutText, setAttribute, setAttribute, setAuthor, setBgColor, setCodePages, setCopyright, setHelp, setLogOut2, setName, setOutMode, setOutMode, setPurpose, setTitle, setUsage, setVerbose, setVerbose, setVerbosity, setVerbosity, setVersDate, stop, threeLineEndMsg, toString, twoLineEndMsg, twoLineStartMsg, valueLang, valueLang, wakeMainThread
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
retVtext
public int contLogLength
App.verbose
is true the mail content will be logged, but
truncated in the log output after a maximum of contLogLength
characters. The truncation does not happen if contLogLength
is
<= 42. If the mail text
is truncated in the log, that will
be signalled by dots ( ....).public String to
parse
ed RFC 822 definition file contFile
that
will be added to the addressees defined in the parsed file.public String cc
to
property apply.public String bcc
to
property apply.public String subject
public boolean timeStamp
public String timeFormat
timeStamp
is true, this format will be used for the mails's
date (header) field.public String text
contFile
) read.public String contFile
public boolean parse
public String contFileEncoding
contFile
is not empty, it is tried to read the mail's text
content directly from there respectively to parse
the whole
RFC822 mail definition from it.contFileEncoding
will be used for that file or
URL.public String attach
attach
is nor empty it is tried to add the file denoted by
it as a true attachment to the mail.public String userName
public String userPass
public boolean proxySet
public static void main(String[] args)
args
- command line parameterdoIt()
,
App.go(String[])
public int doIt()
doIt
in class App
main(Strin[])
,
App.go(String[])