MailCall (TM)
Copyright 2000 by Allen Miglore.  All rights reserved.
Distributed under license by Synergetic Data Systems Inc.
Web: http://synergetic-data.com
Email: sdsi@synergetic-data.com

See mailcall.pdf for installation, setup, and usage information.

Version 2.0.00 released 4/11/2002
Version 2.0.01 released 4/26/2002
Version 2.0.02 released 5/14/2002
Version 2.0.03 released 6/4/2002
Version 2.0.04 released 8/19/2002
Version 2.0.05 released 1/3/2003
Version 2.0.06 released 6/9/2003
Version 2.0.07 released 8/29/2003
Version 2.0.08 released 9/11/2003
Version 2.0.09 released 7/27/2005
Version 2.0.10 released 4/20/2007
Version 2.0.11 released 12/12/2007
Version 2.0.12 released 12/1/2008
Version 2.0.13 released 8/21/2010
Version 2.0.14 released 2/23/2012
Version 2.0.15 released 8/9/2012
Version 2.0.16 released 12/5/2012
Version 2.0.17 released 10/3/2013
Version 2.0.18 released 4/15/2014
Version 2.0.19 released 8/5/2014

3/29/2000 - download now sends mailcall.sds rather than mailcall.ini,
to avoid overwriting existing configuration.  First call to mailcall.bb|pv
will rename mailcall.sds to mailcall.ini, if necessary.

4/3/00 - fixed a problem with the ProvideX version under Windows, where
a message box would pop up indicating an invalid input file.

4/7/00 - clarified the use of mailcall.sds and mailcall.ini in the manual.

Version 1.0.01:

Added dat.status variable to template in mailcall.bb/pv.  Setting this
to a positive value (i.e. dat.status=1) will pass a flag to mailcall.exe
to dislay a status window while it is communicating with the SMTP server.
This, of course, is not used on Unix.

Version 1.0.02:

4/27/00 - corrected a problem with the mmdf interface, by modifying the
contents of mailer= in the mailcall.ini file.  If you update an existing
installation, you will need to manually update your mailcall.ini file.
The line should read:

mailer=echo $LOGNAME >%2; cat % >>%2; /usr/mmdf/bin/submit -uxto,cc* <%2; rm %2


Version 1.1.00:

Added the perl script mailcall.pl for Unix installations.  This eliminates
the need to have sendmail or mmdf configured and operational.  You will,
however, need to have a perl interpreter on your system (the script assumes 
/usr/bin/perl).  If your system doesn't already have perl, you should be able
to obtain a free copy from http://www.cpan.org.

The manual has been updated to describe how to configure mailcall using
mailcall.pl.

In addition, we have changed the license model from Windows and
Unix licenses to single-user and multi-user licenses regardless of
platform.

5/22/00 - changed mailcall.pl to include < and > around to/from addresses.


Version 1.1.01

Added a template value dat.forcebase64, which if set to 1 will force
base64 encoding even on text file attachments.

Corrected a problem where not all lines in a quoted-printable encoded
attachment were properly terminated.

Version 1.1.02

6/26/00 - fixed a hang problem if the subject line contained trailing
spaces while operating mailcall in demo mode.

6/27/00 - fixed mailcall.pl to work with servers referenced by IP address
rather than a hostname.

Known problems:

In DOS versions of BBx4 or PRO/5, the SCALL to mailcall.exe doesn't wait
for completion of the send, resulting in unpredictable problems with the
mail submission file being erased before fully used.  At this time,
mailcall.exe is not compatible with those versions of BBx4 and PRO/5.
Only Visual PRO/5 is supported.

A BBx data server path name may include a comma, which conflicts with
the comma delimiter for multiple attached files.  To attach networked
files, you will need to use a mapped drive or UNC name, or set the PREFIX
to include the data server path and use base file names in the attachments
list.


Version 1.1.03

7/18/00 - fixed problem with MS-DOS PRO/5 where the SCALL to mailcall.exe
doesn't wait for the submission to complete before erasing the submission
file.  This is now handled by a modification to mailcall.exe to use a
second file to notify mailcall.bb when complete.  This feature is
automatically invoked in the PRO/5 environment when the process ID is 0,
which seems to the the case with PRO/5 for MS-DOS.  It can also be
forced by setting the new dat.forcenotify variable to 1.  This flag is
ignored on Unix.

7/18/00 - modified mailcall.exe to return an error code 127 if the Cancel
button is pressed in the status window while submitting mail.  This is
passed back in the errmsg$ variable from mailcall.bb|pv.


7/24/00 - fixed a problem when no attach was provided and mailcall would
hang until interrupted; problem introduced in 1.0.03 when adding support
for DOS.

7/24/00 - removed trailing boundary that was causing Outlook to show
an additional empty attachment.

11/9/00 - modified mailcall.exe to display error message boxes only if
the status flag is set.  This way, automated mailcall jobs don't require
user intervention if an error occurs.  The application should check
errmsg$ when mailcall.bb|pv returns, as that is the only place where
an error message will be returned.


Version 1.1.04

Added Bcc: support to mailcall.bb/pv via dat.bcc$, and in the mailcall.exe
and mailcall.pl mailers.  The sendmail mailer is documented to already
support Bcc: headers.  The mmdf documentation doesn't indicate support,
however, so you should only use dat.bcc$ if your are using one of the
other mailers.

Added a patch in mailcall.exe and mailcall.pl to support ESMTP servers
that do not correctly support plain SMTP conversations.  We have seen
this specifically in the qMail server, where it responds to a generic
SMTP HELO command as if a ESMTP EHLO command had been issued.

5/9/01 - corrected mailcall.exe to skip incorrect attempts to email
null addresses.  Without a to, cc, and bcc address, mailcall.exe would
attempt one or two null addresses.  Some smtp servers responded with
errors while others ignored the problem and worked.


Version 1.1.05

Added support for control of the MIME type of the message body.  Set
the dat.bodymime$ field to the MIME type, such as "text/html" that
matches the content of the dat.msgtxt$ data.  The default is text/plain.
Note that mail readers interpret non-text message bodies differently.
Some can render an html body completely, while others render some of
the html coding, while still others treat the body as an attachment.

Added the dat.charset$ field, which can be used to override the value
specified in the charset=value line in mailcall.ini, which itself overrides
the default value of "us-ascii".

Version 1.1.06

Corrected parsing of From: addresses to allow complex structures that
contain the simple email address inside angle brackets, like
dat.from$="Acme Company <sales@acme.com>".

Version 1.1.07

Changed the base64 encoding algorithm to improve speed on large attachments.
The improvement is approximately 500%.


--unallocated release
1/30/02 - fixed pvx windows version to use invoke wait when executing
mailcall.exe.

2/20/02 - changed name of mime.types file to mime.typ in order to better
accomodate CD writing ISO syntax.

3/13/02 - fixed a potential problem if an empty file follows a non-empty
file in the attachment list, where a final fragment from the prior file
might be placed into the empty file attachment.


Version 2.0

Added authentication support, native socket support, status and dialog
options supporting both character and gui modes.  See the manual for more
details.


2.0.01

4/20/02 - updated pvx version to have protection against screen/keyboard
errors when running in background.

4/26/02 - corrected error 38 line 150 in pro5 version

4/26/02 - corrected to handle automatic mailer generation when mailcall.bb/pv
is found via a prefix and no path info is used for call.

4/26/02 - corrected an error 40 in character-mode pvx dialogs


2.0.02

5/14/02 - added dat.timezone$ value, which overrides other timezone
settings, based on the timezone= value in mailcall.ini for Windows and
the date +%Z result in Unix.

2.0.03

6/3/02 - Correct an error 29, line 11130, if x.status=0 and x.dialog=1,
when in GUI mode.

6/3/02 - Flush 220- until a 220<space> response on the initial connection
to the smtp server.  Code updated includes the native socket .bb and .pv
code, the mailcall.pl script, and mailcall.exe.

6/3/02 - Allow forcing the character dialog and status windows even it
in a GUI environment (x.charinterface=1).

6/3/02 - Allow forcing of logging of detail data in the native socket
interface (x.logdata=1).

6/3/02 - Generate mailcall.p4 specifically for use with BBx4.  The
mailcall.bb program is not a pro5 program, so tokenizer errors would
not be passed into the pro5 environment.

2.0.04

6/5/02 - Corrected a problem with vpro5 did not return a hostname value
in info(3,4), and an attempt to use the mchost.exe command caused 
work file channels to be confused.

6/12/02 - corrected a problem with a trailing mime boundary, which caused
Outlook attachments to sometimes be truncated by 1 to 3 bytes.

7/24/02 - corrected a problem where an errmsg$ of ERROR is returned if
mailcall is not in the prefix.

8/15/02 - Added client edge support for VPRO/5 dialog box controls.

8/15/02 - Restore original context after VPRO/5 gui activity.

2.0.05

1/3/03 - Corrected a problem when attachments are selected via the dialog
window.  Attachments were either not sent at all, or were improperly 
delimited and the receiving email software could not extract them.

4/1/03 - Added chmod to the auto-generated perl mailer command line to
force permissions on log files to rw-rw-rw, preventing permission errors
for the next user to use mailcall.

2.0.06

6/6/03 - GUI Visual PRO/5 dialog now appends selected attachments to the
attachment text box.

6/9/03 - Corrected a problem with the GUI VPRO/5 dialog not picking up the
first message line in the message body text.

2.0.07

8/29/03 - Corrected problems with vpro5 dialog attach button not always
appending the file selected to existing attachments.

8/29/03 - Added a save of template data modified with the dialog before
mail is sent, so if an error occurs, the calling program can restore the
last known dialog by simply re-calling with the current template.

8/29/03 - Corrected an error 14 at 9175 when invoking the character
dialog.

2.0.08

9/11/03 - Corrected a problem in native socket communication with the
smtp server, if a submission line started with a period and contained
additional data.  The result would be a loss of the period.

2.0.09

5/14/04 - Added a 2>/dev/null redirect to the auto-generated mailcall.pl
execution's chmod command.  This command's purpose was to correct permission
on the log and error files generated by the perl mailcall.pl execution, but
under some circumstances the chmod could generate error messages back to
the user's screen.

11/18/04 - Modified character mode keyboard handler under BBx to support
BBj environments when using status or dialog mode.

7/27/05 - Modified the mailcall.pl mailer script to support the IO::Socket
Perl module, making it more compatible with current Perl releases.

8/29/05 - Corrected some conditions that masked errors when running with
dialog options turned on under BBj.

5/1/06 - Corrected an error when resetting the BBx keyboard settings after
a status window or dialog window was used.

2/26/07 - Modified VPRO/5 dialog support to handle initial message text
values greater than 255 characters without producing an error 29.

2.0.10

4/20/07 - Added support for four fields in the mailcall template argument.
The additional fields are server, port (numeric), hostname, and key.  Any 
values supplied will override any entries provided in mailcall.ini.  It is
now possible to use mailcall without any entries in mailcall.ini, or
even without mailcall.ini present at all, provided all necessary entries, 
including server and key, are specified in the template.

2.0.11

6/21/07 - Corrected a problem with encoding of text files that contain
non-printable data at certain positions, whiched caused a line break in
the middle of quoted-printable hex encoding.

12/12/07 - Change to allow template dat.timezone$ to override mailcall.ini
timezone= setting, and to resolve before any attempt to get timezone from
the operating system, which can hang under pvx on some operating systems.

12/12/07 - Added mailcall.ini usemailer=1 setting to force the use of
an active mailer= line rather than native sockets under pvx.  This allows
the use of sendmail or mmdf mailer lines if desired.


2.0.12

12/1/08 - Added support for SMTPS servers, which is SMTP over an SSL
connection.  This is supported in environments where SSL is supported by
BBx or ProvideX.  In BBx, the alias used must be an "ssl" type, such as
'alias N1 ssl'.  To specify the alias to use, use the mailcall template
x.alias$ variable or set stbl("$mcalias") to the name.

To use SMTPS, specify the server name with a "ssl:" prefix in the
template or mailcall.ini file, such as "ssl:smtp.gmail.com:465".  The
port suffix is optional.  The port defaults to 25 for standard SMTP, and
465 for SMTPS, or can optionally be specified with the port template variable
or mailcall.ini line.

Note that SMTPS is not the same as the STARTTLS feature found in some
SMTP servers, and referred to as TLS security in many implementations.
SMTPS uses SSL security upon connection, whereas STARTTLS negotiates 
SSL security after the initial connection.  Neither BBx nor ProvideX
provide the capability to implement the STARTTLS feature.

2.0.13

8/21/10 - Added logic to use the internal pvx timezone data if no timezone
value is provided in either mailcall.ini or the x.timezone$ template
variable.  This new feature is not supported in BBx implementations.

9/15/10 - Added trimming of addresses found inside brackets, such as when
addresses are formatted like: "Name" <xx@xxx.xx  >.

9/29/10 - Added a template variable t.canceled, which is set to 1 if
a dialog is presented and the user presses Cancel.

2.0.14

2/23/12 - Disabled the X-MC: header by default, as there have been reports
of spam filters possibly blocking MailCall emails due to encountering an
unknown custom header.  This header can be forced back on by either
adding xmchdr=1 to the mailcall.ini file, or setting x.xmchdr=1 in the
MailCall template.

2.0.15

Modified the code for VPRO5 dialogs to address changes at VPRO5 rev 10.

8/9/12 - Enhanced attachments to include support for content ID values,
enabling attached images to be referenced by html message content.  See
the manual for details, under Inline Attachments.


2.0.16

12/5/12 - Added an option to use the openssl executable for base64 encoding,
a fairly expensive process in Basic.  To implement this, add a line to
mailcall.ini, openssl=/path/to/openssl, or specify t.openssl$="/path/openssl"
in the mailcall template.  This will instruct mailcall to execute the
named program to perform base64 encoding.  On most Linux systems, the
openssl binary is in /usr/bin, so you can simply specify openssl=openssl.
On Windows, you can install the open source openssl tool and point to
the openssl.exe binary.

12/6/12 - Added fallback code to the above openssl logic so if the openssl
command fails, standard encoding methods will be used.

2.0.17

6/27/13 - Added support for literal \ characters that don't interpret the
next character as one of the special sequences (\n, \t, \r).  Now you can
specify \\ to indicate a literal backslash.  \\tmp\\xx is sent now as
\tmp\xx whereas previously the \t would have been replaced by a tab.

10/3/13 - Added a BBj-specific suite of files to the build process.  You
can call mailcall.bj under BBj to avoid the overhead of the automatic
internal conversion BBj performs when it loads a PRO/5 version of a program.


2.0.18

4/14/14 - Added support for STARTTLS in pxplus 11.0 and higher, including
UnForm 9.0. 

2.0.19

8/5/14 - Added support for STARTTLS in BBj 14.10 build date 7/31/2014.

9/25/14 - Modified STARTTLS support in BBx environments to only be invoked
under BBj 14.10+.  This prevents timeouts when working in BBx versions
that do not support STARTTLS.


12/16/14 - Added support for a notls: prefix in the server value, to turn
off automatic STARTTLS support if the server advertises it.  This allows
standard (non-TLS) connections in cases where SSL libraries do not work
or are incompatible at the server or client.

2.0.??

5/31/15 - Changed pxplus 'option' use when invoking a STARTTLS session,
to help with sporatic issues with openssl.

7/9/15 - Added automatic suppression of STARTTLS invocation when connecting
to a server via SMTPS.  The two modes are incompatible, but some servers
appear to advertise STARTTLS even on their SMTPS port.

12/16/15 - Corrected a fatal error 41 at 1360 when mailcall.ini was 0 bytes.

2/1/17 - Tighted the invalid address rule to ensure that at least one
character appears before the @.

