MAIL - Mail interface
<< Click to Display Table of Contents >> Navigation: »No topics above this level« MAIL - Mail interface |
vpxPrint allows to send mails automatically or on user's request in the preview window.
Settings for sending a mail:
<MAILTO= [TO:mailaddress1[,mailaddress2…] ] [ CC:mailaddress1[,mailaddress2…] ] [ BCC:mailaddress1[,mailaddress2…] ] > |
Mail destinations.
Each address group is a comma delimiter list. Each group is separated by a space from the previous one. Example : <MAILTO=TO:info@4gl.fr,bill@bill.com CC:xxx@y.com> |
|
<MAILSUBJECT=subject> |
Mail message subject. |
|
<MAILBODY=Message> |
Use TAB characters for line feeds. Note : The vpxPrint report is always sent as a document attached to the mail. The mail body is used to specify the message.
The body can be an HTML sequence: If the mail body begins by <HTML>, it's evaluated as an extended HTML body. As "<" and ">" characters are the same as vpxPrint, you must escape them with "\<" and "\>" respectively, see below the escapeHTML().
The escapeHTML() function inserts easily escape characters(\) before all < and > characters. This function preserves any "\<" and "\>" already present in the input string.
Syntax: "<MAILBODY=" + escapeHTML("<html>Example of an <strong>HTML</strong> body") + ">" |
|
<SENDMAIL= [ PDF | xPrint ] [ ,DIALOG | NO-DIALOG ] > |
Examples: <SENDMAIL=PDF,NO-DIALOG> <SENDMAIL=xPrint,NO-DIALOG> <SENDFAX=PDF,DIALOG> Note: The dialog or no-dialog is used to tell to the mail interface to activate or deactivate the dialog box before sending. |
|
<OUTLOOK> |
This tag has no more importance. Since the version 9.18, the Outlook is the default value. This tag is kept for compatibility issues. If you dont want to use Outlook, insert a tag </OUTLOOK>
Former discussion: Tells vpxPrint to use Outlook whenever possible (Outlook should be installed). If Outlook is not present, vpxPrint switches to the MAPI interface. |
|
</OUTLOOK> |
|
vpxPrint will not try to connect to Outlook. |
<MAILATTACH=file1[,file2....]> |
Specifies additional files to join to the mail message. |
|
<MAILRECEIPT= TRUE | FALSE> |
If true, asks for a receipt when the message is read. OUTLOOK only. |
|
|
This tag suppresses the embedding of the report in the mail. vpxPrint can be used as a standard mail program: specify the recipients, the file(s) to join, the subject and the body or the html body. With the availability of the <MAILRECEIPT>, this is a complete solution to send mails without reports. |
|
<MAILSelfClient= TRUE | FALSE>
Default = false |
vpxPrint will send mails using the self interface included. This is intended to interface with exchange servers when no mail client is installed.
This option is valid only when CDO/MAPI session is active. In all other cases, this option has no effect |
|
|
Tells to vpxPrint to ignore the standard mail interface. When the user clicks on the mail button, vpxPrint exits and adds 1,000,000 to the return value. Use printFileStat() to check this value. You can then use your own mail interface. |
|
*Outlook only |
Sets the account information |
|
<MailOnBehalf> |
<MAILOnBehalf=myadress@live.com> *Outlook only |
Sets the sender information |
<MAILSilent> |
*Outlook only |
Does not display the error messages on the screen. Warning: the message can be not sent without visual information. You must check the Mail interface result to see the status, see below. |
General rules:
•Multiple recipients are allowed
•<SENDMAIL> tag opens the email software.
•Without any parameter in the sendmail:
1.The original report file is sent like that, in .txt or .xpr mode (except if <sendmail=pdf> is specified)
2.If there is a <PDF-OUTPUT=xxxx>, the report is automatically sent in .pdf format
3.No-dialog keyword indicates that you will not be asked by Outlook before sending the mail
•if <SENDMAIL=PDF> is specified and no <PDF-OUTPUT> tag exists, a temprorary PDF file is created in the Windows temp directory and deleted when the session ends.
•No sending occurs if <sendmail> is not specified. When clicking on the Mail button, all parameters will be set in the message.
•The current report will be always included in the mail (.xpr or .pdf), except with a <MAILNOFILE> tag.
•TAB characters chr(9) are used to add line feeds in the body (use "<BR>" for HTML bodies)
Technical notes :
•To use the mail interface, Outlook, CDO/MAPI or a correct MAPI interface must be installed on the system.
•The priority order is:
1.Try to open an Outlook Ole session (except if </OUTLOOK>)
2.Try to open a CDO/MAPI session ('MAPI.SESSION'), You must deploy vpMail.dll if <MAILSelfClient=true> and a dialog is needed.
(more info on vpMail.dll)
3.Try to send the mail thru the basic MAPI interface
Mail status can be checked with the entry point getMailResult of xprint.dll:
DEF VAR i AS INT.
RUN getMailResult(OUTPUT i).
Return value is the sum of the following conditions:
▪00000001 Mail is sent
▪00000010 Mail error
▪00000100 Mail is saved // Applies to Outlook, no support for MAPI
▪00001000 Mail attachment error
▪00010000 Outlook
▪00100000 CDO
▪01000000 MAPI
PROGRESS users can check the return code with mailStatus() defined in xprint.i:
Other environments provide string return values like "00010001", see specific settings.
Syntax:
<logical> = mailStatus( <Condition_to_check> ).
where <Condition_to_check> is one of:
•mailSent 1
•mailError 2
•mailSave 3
•mailAttachError 4
•mailOutlook 5
•mailCDO 6
•mailMAPI 7
All of these values are defined in .
Example:
RUN printFile( "c:/temp/myReport.xpr"). | /* no need to call printFileStat() */ |
IF mailStatus( MailSent ) THEN
MESSAGE "Mail is sent" VIEW-AS ALERT-BOX.
-- OR --
/* RUN getMailResult(OUTPUT J). */ /* NOT NEEDED */
DEF VAR a AS CHAR NO-UNDO.
IF MailStatus(MailSent) THEN
A = 'Sent '.
IF MailStatus(MailSave) THEN
A = A + 'Save '.
IF MailStatus(MailError) THEN
A = A + 'ERROR '.
IF MailStatus(MailAttachError) THEN
A = A + 'AttachERROR '.
IF MailStatus(MailOutlook) THEN
A = A + 'Outlook '.
IF MailStatus(MailCDO) THEN
A = A + 'CDO '.
IF MailStatus(MailMAPI) THEN
A = A + 'MAPI '.
MESSAGE "Done." SKIP(1)
/* 'Mail Return code:' J SKIP(2) */ | /* NOT NEEDED */ |
'Mail status:' A
VIEW-AS ALERT-BOX.