At 07:45 PM 1/16/2009, Steve Johnson wrote:
I have been experimenting with the e-mail capability of Rbase 7.6 but have
run into a few problems. The biggest is whether one can pass a variable to
the |EMAIL_TO_LIST parameter (to pass an e-mail address from the database).
Steve,
In order to achieve such goal, create a text string with concatenated
parameters and all embedded variables, and then use "&Command" approach
to execute the entire string.
Use the following example to understand the entire process.
-- start here ...
IF (CVAL('DATABASE')) <> 'RRBYW14' OR (CVAL('DATABASE')) IS NULL THEN
CONNECT RRBYW14 IDENTIFIED BY NONE
ENDIF
-- Verify the existence of C:\Temp folder to store PDF reports for attachment
SET VAR vChkFile INTEGER = NULL
SET VAR vChkFile = (CHKFILE('C:\Temp'))
IF vChkFile <> 1 THEN
MD C:\Temp
ENDIF
-- Define Global Variables
SET VAR vTransID INTEGER = 1002
SET VAR vResponse TEXT = ('Invoice_'+(CTXT(.vTransID))+'.PDF')
SET VAR vToList TEXT = '[email protected],[email protected],[email protected]'
SET VAR vBody TEXT = ('Please review attached invoice due
on'&(CTXT(.#DATE+30)))
-- Now concatenate the entire syntax as one text string
SET VAR vCommand TEXT = +
('PRINT Invoice WHERE TransID ='&(CTXT(.vTransID)) +
&'OPTION PDF|FILENAME C:\Temp\'+.vResponse + +
'|EMAIL ON' + +
'|EMAIL_HOST'&'smtp.yourmailserver.com' + +
'|EMAIL_USERID yourmailuserid' + +
'|EMAIL_PASSWORD yourmailuserpassword' + +
'|EMAIL_TO_LIST'& .vToList + +
'|EMAIL_FROM_NAME'&'Your Name Here' + +
'|EMAIL_FROM_ADDRESS'&'[email protected]' + +
'|EMAIL_SUBJECT Invoice' + +
'|EMAIL_BODY'& .vBody + +
'|EMAIL_ATTACHMENTS C:\Temp\'&.vResponse + +
'|EMAIL_PORT 25' + +
'|EMAIL_AUTHENTICATION ON' + +
'|EMAIL_DELETE_AFTER_SEND OFF' + +
'|EMAIL_SHOW_DIALOG OFF')
&vCommand
RETURN
-- End here ...
Note:
. Make sure to update values for vToList and all EMAIL_xxxxx
parameters accordingly.
. Create a command file and then TRACE the code to see the whole
process using the
Step-By-Step [F10] key.
. Watch for any -ERROR-s and correct 'em accordingly.
A technical article is also available at From The Edge:
http://www.razzak.com/fte/
Topic: Understanding the Built-In E-Mail Capabilities of Report
Designer in R:BASE
Hope that helps!
Very Best R:egards,
Razzak.
--- RBASE-L
================================================
TO POST A MESSAGE TO ALL MEMBERS:
Send a plain text email to [email protected]
(Don't use any of these words as your Subject:
INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: INTRO
================================================
TO UNSUBSCRIBE:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: UNSUBSCRIBE
================================================
TO SEARCH ARCHIVES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: SEARCH-n
(where n is the number of days). In the message body,
place any
text to search for.
================================================