Kbase P101727: A pure 4GL way to send emails (socket programming) with MANY FEATURES
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/18/2008 |
|
Status: Unverified
GOAL:
How to send an email to multiple recipients from Progress 4GL with SMTP and a solution that handle the password of the SMTP server user?
GOAL:
What is smtpmail57.p?
GOAL:
How to send an email from the 4GL
GOAL:
How to send an email with SMTP from the 4GL
FACT(s) (Environment):
Progress 9
OpenEdge 10
FIX:
smtpmail57.p is an Open Source code to send emails to multiple recipients and that can handle the password of a SMTP server. It is available at the following URL:
http://www.amduus.com/OpenSrc/SrcLib/Mail/smtpmail57.p
Header of the code:
/*-------------------------------------------------------------------
File........: smtpmail.p
Version.....: 5.7 - Oct 31, 2003
Description : Opens up an SMTP connection and sends an email message
to multiple recipients.
Input Param :
mailhub char - settable SMTP server name/IP address
optionally append :XX where X is a port number of the
SMTP server. 25 is default port.
EmailTo CHAR - list of email addresses separated by
semicolons or commas (All semicolons will
be replaced by commas so don't include stuff
like Smith, John) <"My'>me@myaddress.org>"My Name"
EmailFrom CHAR - email address of user originating the email,
the SMTP server should require that this user
is real. Format looks like:
<user>@<host>[;<descriptive name>]
Example:
foo@bar.com[;Mr. Foo Bar]
If you want Delivery or Read Receipts, add a chr(1) delimiter
to the end of the EmailFrom and then one or two comma delimted
logical strings (Yes or No) for Delivery and Read Receipt
respectivley.
Example:
"foo@bar.com;Mr. Foo Bar" + chr(1) + "yes,no"
will give a delivery receipt and no read receipt. These
PARAMETERs are strictly optional and not required.
Delivery and read receipts are always returned to the EmailFrom
address.
EmailCC&nb.sp; CHAR - list of email addresses separated by
semicolons or commas (All semicolons will
be replaced by commas so don't include stuff
like Smith, John) <"My'>me@myaddress.org>"My Name"
For BCC (blind copies) add a ^B to the end of the address.
Example: me@myaddress.org^B
Attachments CHAR - Comma separated list of attachment descriptions
Format looks like:
file[:type=<mimetype>][:charset=<charset>][:filetype=<filetype>]
Special Filetypes are: BINARY, B64ENCODED if you use
B64ENCODED make sure to call smtpmail with RemoveEncodedFiles
as the EmailTo PARAMETER after sending all your emails
or the encoded files will build up in your temporary
directory.
LocalFiles CHAR - comma separated list of filenames to the files
described in Attachments. The filenames in this
PARAMETER must either be in the Progress path or
have the entire path specified. In contrast to
filenames in the Attachments are the filenames to
show for the Attachments.
Subject CHAR - Subject line
Body CHAR - Actual text of the message can be whatever you
want as long as you include the correct Header
information in the MIMEHeader.
If you are just sending plaintext you can leave
the MIMEHeader blank, this is default setting
If you wanted to send HTML you might use:
type=text/html:charset=us-ascii:filetype=ascii
MIMEHeader CHAR - [type=<mimetype>][:charset=<chrset>][:filetype.=<type>]
BodyType char - File/text. Determines whether a file or text
goes into the message body.
L_DoAUTH LOGICAL - yes if authentication is requiered
C_AuthType CHAR - Type of authentication. Currently supported types:base64
C_User CHAR - The name of the SMTP server user
C_Password CHAR - The password of the SMTP server user
Output Param:
oSuccessful LOGICAL - Yes the message was succesfully generated
No there was some error that prevented message from
being successful generated.
? there may have been a problem with a recipient
or format of the email.
vMessage CHAR - Any error messages from the server
Author......: Paul C. Keary - plk@cpec.com - Coe Press Equipment Corp.
Contributors:
Scott Auge - Amduus
Mario Paranhos - BravePoint, Inc. (770) 449-9696
Sam Schroeder - sschroeder@mn.rr.com
Geoff Crawford - Innovative Client Servers
Steven Lichtenberg - Safemasters, Inc.
Mark Bremmeyr - I S Solutions, LTD.
S.E. Southwell - BravePoint, Inc. (770) 449-9696
Steven Jellin - ELCB Information Services
Edgar Medrano - Operadora de Desarrollo Social, S.A. de C.V.
Chris Chaney - Sumisho Computer Systems
Garret Schweitzer - Aperum
David J. Craven - davidjcraven@comcast.net
Copyright...: FreeFramework 2001 - http://www.freeframework.org
License.....: Use freely - See http://www.freeframework.org/license.shtml for more>detail
Created.....: 6/26/01
Notes.......:
This program was adapted from a combination of the work of
Scott Auge and distributed as part of his mailsdk
Scott had laid the groundwork for sending an email with
attachments. But his original code did not verify the
servers response to make sure the data was being sent
properly.
Mario's original work smtpmail.p was a big help in
developing an understanding of how SMTP works. His
program was very elegant in the way it deals with Sockets
however Scott's work had done much more in the area of
including attachments.
SMTP Protocols taken from RFC821
MIME Protocols taken from RFC1521
SMTP AUTH taken from RFC2554
http://cr.yp.to/docs/smtplf.html - CR/LF problem
Disclaimer..: This program is not fully tested especially with
regard to the Reading of the Server Responses, and
encoding of the MIME message body . .