|
V32SendMail()
|
| Sends email with attachments
by either using default mail client installed on the screen, typically
Outlook Express, or through SMTP, as the user selects with or without user
interaction. |
|
Syntax
|
| V32SendMail( [ nMode ], [
lWantInfo ], [ lDraft ], [ lClipB ], [ cFrom ], [ cTo ], [ cSubject ], [
cAttach ], [ cMessage ], [ cSignature ], [ cFont ], [ nFontSize ],
cProtoSend ], [ cSmtp ], [ nClipBPos ], [lDefaultWindow], [
lChkConnected ], [ cConnectionId ] ) |
|
Arguments
|
| [ nMode ] |
Numeric either 1 or 2 to denote the mode
of operation. [ 1 ] denotes that Mail Dialog with all other fields filled,
if supplied, is opened and user is allowed to edit and can opt for the
<cProtoSend>. [ 2 ] means mail is sent without any user interaction at the
background. Default is [ 1 ]. |
| [ lWantInfo ] |
Logical whether info in the fields of Mail
Dialog and its state of affairs is returned back to the application.
Default is FALSE, means default info is returned. But if set to TRUE, an array
of 7 elements is returned. Please note that if <nMode> is set to 2 ( Send
) then lWantInfo == FALSE. |
| [ lDraft ] |
Mial Dialog can be opened in
two modes, word-wrap or draft. Default is FALSE means dialog is always
opened in word-wrap mode. If set to TRUE then tabular data can be entered.
Line break is performed explicitly with <RETURN> key. This mode is
useful when drafting tabular data as a body of mail. |
| [ lClipB ] |
Logical to denote whether any
text copied to clipboard be included in the body of mail automatically.
Default is FALSE. If <lClipB> is set to TRUE then <cMessage>
and <cSignatures> will not be appended at the end of the clip board
text. Only clipboard data will be pasted in the message text. This flag is
handy when you copy something, for example, records of a browser into the
clipboard and want to activate V32SendMail(). |
| [ cFrom ] |
Character string representing
your own email id. <cFrom> will also be used for 'Reply-To' section
of the mail contents. Default is string returned by GetEnv( 'MAIL_FROM' )
system variable. |
| [ cTo ] |
Character string representing
valid email address of the reciepient. Default is empty string. If
<nMode> is set to 2 and <cTo> is empty then no mail will be
sent. |
| [ cSubject ] |
Character string to represent
Subject: field of the email dialog. Default is empty string. Please note
that though no error will be generated if <cSubject> is empty, but
it is in true spirit of the email protocol that a short description of
what is contained the message body be there. |
| [ cAttach ] |
A valid and complete file name
with drive and directory. Default is empty string means no file. At
present only MAPI protocol supports file attachment. SMTP protocol is at
some infant stage and cannot send an attachment. Some future version will
surely include it. |
| [ cMessage ] |
Text of message body. As
described above, if <lClipB> is set to TRUE, then <cMessage>
will not appear in the mail body. CR+LF pairs are supported in the message
text. |
| [ cSignature ] |
Text comprising signatures of
the sender. These signatures will be appended at the bottom of the
<cMessage>. If <lClipB> is set to TRUE then signatures will be
discarded just like <cMessage>. |
| [ cFont ] |
String to represent valid
Windows font name to be the default font used in the message area of the
mail dialog. Default is 'Courier'. |
| [ nFontSize ] |
Numeric font size to determine
the height and width of <cFont>. Default is 12. |
| [ cProtoSend ] |
Character string to represent
the send protocol. It can be one of the two, 'MAPI' and 'SMTP'. Default is
'MAPI'. This flag will decide whether mail will be sent via Simple Mail
Transfer Protocol or default mail client installed on the system, which
is, typically, Outlook Express. |
| [ cSmtp ] |
Character string to represent
your valid SMTP Server address. SMTP Server address is one through which
service you are connected to Internet. Default is the string returned by
GetEnv( 'MAIL_SERVER' ). If no SMTP Server is defined then despite opting
for SMTP protocol through <cProtoSend>, Vouch32 will attempt to send
it via MAPI. |
| [ nClipBPos ] |
It will allow you to place Clipboard text either above the
<cMessagage> or below it. 1 is for above, 2 for below. Default is 1. |
| [
lDefaultWindow ] |
Logical to specify whether
mail dialog of default mail client be opened or Vouch32 defined mail
dialog. By default it is FALSE means Vouch defined dialog will be opened.
This parameter is considered whrn <nMode> = 2. If
<lDefaultWindow> is set to TRUE then values of dialog fields will
NOT be returned back to application and <lWantInfo> will be set to
FALSE. |
| [
lChkConnected ] |
Logical to specify if Vouch32
check the status of internet connection presence. By default it is FALSE
means Vouch32 will not check whether system is connected to internet or
not. If set to TRUE and if internet connection is found to be absent,
dialog to connect to internet will be opened. Which internet connection
will be used will depend upon the <cConnectionId>. |
| [
cConnectionId ] |
Character string pointing
towards the internet connection identity which will be opened for
connecting. By defauklt it is null string means default internet connction
dialog will be opened. This parameter will be considered only when
<lChkConnected> is set to TRUE. |
|
Returns
|
An array of 7 elements with
following values:
nSendMode - 1 . user has clicked
MAPI 2. SMTP 3 Ok only 0 . all other
actions
cTo
- the address of the reciepient
cSubject
- subject line of the message
cMessage
- message body
cAttach
- attached file name with path and drive, if any
cFrom
- your own identity
nError
- not active yet, for future usage, returns 0 always
If <lWantInfo> is TRUE. the info filled in the Mail
Dialog alongwith its state is returned. Otherwise info sent are
returned.
|
|
Description
|
| V32SendMail() is
a highly interactive email system wherein you can control each and every
aspect of end user's needs and behaviour. A resonably good looking
interface with host of options make the Mail Dialog useful for the end
users. Dialog is resizable and all the controls fits accordingly.
Both protocols of sending mail are supported, viz., MAPI and SMTP. This
alone makes this utility very useful. In my applications branded as
'Vouch' it is working like a charm and have received a wide acclaim from
my clients.
This function can be used with or without user interaction. This again
renders it indispensable as real time data can be configured to do the job
at the background.
At its first incarnation it is not supporting multiple reciepients.
This feature will be added at some future release. Also if
<cProtoSend> == SMTP then attachment can not be delivered. This
functionality is also scheduled for some next release.
MAPI protocol is all the powerful protocol because of the fact that if
internet connection is not active, the mail is deposited in the Outbox of
the Outlook Express, the default mail client installed on the machine. It is
very handy and you are sure that mails generated by your application are
not lost. Then the connection can be activated any time and OE can be
instructed to post the mails.
Ver 3.0 On demand of many
developers a new parametr is added <lDefaultWindow>. This parameter
allows the flexibility of using both windows, default mail client's and as
well as Vouch32's for drafting mails. Both protocols have merits and
demeris. If Vouch32's dialog is used, application is capable of receiving
back the field values but lacks the functionality ( as per current version
) of selecting addresses from address book. If user is accustomed to
a specific mail client, the setting it TRUE will be more useful. If values
are useful and interface need be simple, Vouch32 mail interface will be
useful. It depends upon the situation what is required and when. Also
where tabular data has to be mailed, Vouch32 mail dialog may prove to be
very useful.
|
|
Usage
|
#define CRLF chr( 13 )+chr( 10 )
function main()
local cFrom := 'info@vouchcac.com'
local cServer := 'mail.glide.net.in'
local cSign := 'Pritpal Bedi'+CRLF+'http://www.vouchcac.com'
SetKey( K_CTRL_F12, { || V32SendMail( 1, .f., .f., .f., cFrom, /* cTo */, /* cSubject */, /* cAttach */, /* cMessage */, cSign,
/* cFont */, /* nSize */, /* cProto */, cServer, /* nClipBPos */) } )
// Program Start
// Program End
return nil |
|
Tips
|
| I am using this
feature in two ways. One is exactly the same which is demonstrated under <Usage>
section.
The other way is, though vagou, but you can exploit: I print the
browsers onto the clipboard and then invoke
V32SendMail( 1, .f., .t., .t., cFrom, GetMailId( oBrw, BRW_TO ),
GetMailId( oBrw, BRW_SUBJECT ) )
Mail Dialog opens and all the field values are placed and the browser
printed on the clipboard appears in the message area. Then I add
signatures as needs be and click on <Send MAPI> button. |
|
A View
|
 |