Below is the code to create a Mapi call to Outlook to create an Outlook e-mail ... however, I would like the whole process be silent and be able to launch the SEND button automatically without being seen nor have any interaction with the user.
When I run the code .. an Outlook e-mail is generated, but the user has to click on the Send button ... unfortunately I can not use CDO .. because my client has a "blurb" "This came from the internet warning" embedded in the CDO text and for security reasons, the client has SMTP closed off but to all registered devices like MFP, multi function printers that scan to e-mail.
The only other option is to use their corporate Outlook client.... as you can see .. I can create the e-mail, but it takes the client to click the send button .. Any idea on how to make the entire process silent and be able to button:Click() the Send button to launch the e-mail ...
Appreciate any advice and help
Thanks
Rick Lipkin
- Code: Select all Expand view RUN
//----
#Include "FiveWin.ch"
#Include "Mail.ch"
//----------------------------
Func Main()
Local oDlg
Local oSay1,cSay1,oSay2,cSay2
LOCAL oBtn1,oBtn2
Local oSubject,oTo
Local cSubject,cTo
Local oMemo,cMemo
Local oFontB
cSubject := space(50)
cTo := Space(40)
cMemo := "Please fund my trip to the Bahamas"
cSubject := "Trip to the Bahamas"
cTo := substr("r1.1955@live.com"+space(40),1,40)
oFontB := TFont():New("Ms Sans Serif",,-6,.F.,.T. ,,,,.F. )
DEFINE DIALOG oDlg RESOURCE "MEMO" ;
cSay1 := "Subject"
cSay2 := "To"
REDEFINE SAY oSay1 var cSay1 ID 301 of oDlg UPDATE
oSay1:SetFont( oFontB )
REDEFINE SAY oSay2 var cSay2 ID 300 of oDlg UPDATE
oSay2:SetFont( oFontB )
REDEFINE GET oSubject var cSubject ID 303 of oDlg UPDATE
REDEFINE GET oTo var cTo ID 302 of oDlg UPDATE
REDEFINE GET oMEMO VAR cMEMO MEMO ID 304 of oDlg UPDATE
REDEFINE BTNBMP oBtn1 ID 111 of oDlg ;
PROMPT "Create Mail" LEFT 2007;
ACTION ( _SendMapiMail( cTo, cMemo, cSubject , oDLg ) )
REDEFINE BTNBMP oBtn2 ID 112 OF oDlg ;
PROMPT "Cancel" LEFT 2007;
ACTION ( oDlg:END() )
ACTIVATE DIALOG oDlg ;
ON INIT( oDlg:Hide(),oBtn1:Click() );
VALID (!GETKEYSTATE( 27 )) // do not allow esc key here
Release Font oFontB
Return( nil )
//---------------------------------
Static Func _SendMAPIMail( MailTo, cText, cSubj,oDlg )
PRIVATE oMail
MailTo := TRIM( MailTo )
DEFINE MAIL oMail ;
SUBJECT cSubj ;
TEXT cText ;
FROM USER ;
TO MailTo
ACTIVATE MAIL oMail
oMail:ENd()
oDlg:Show()
oDlg:ENd()
RETURN( .t. )