home *** CD-ROM | disk | FTP | other *** search
- * sendmail.prg
- * This program is called from the Send Mail
- * menu item. It displays a dialog to send a
- * message after prompting for and validating
- * a mail name/alias.
-
- PRIVATE tonames,subject,notetext,islogon,newname,oldtalk,retval
-
- IF SET("TALK") = "ON"
- SET TALK OFF
- m.oldtalk= "ON"
- ELSE
- m.oldtalk= "OFF"
- ENDIF
-
- islogon=.F.
- DO CASE
- CASE TYPE('mailsession')#'N'
- PUBLIC mailsession
- mailsession = 0
- mailsession=mapilib('LOGON')
- CASE m.mailsession=0
- mailsession=mapilib('LOGON')
- OTHERWISE
- islogon=.T.
- ENDCASE
-
- IF m.mailsession=0 &&failed to logon
- SET TALK &oldtalk
- RETURN
- ENDIF
-
- m.subject=SPACE(50)
- m.notetext=""
- m.okbtn=1
- m.newname=SPACE(30)
-
- * Call screen to display prompt for entering
- * name to lookup. It is then checked in the
- * resolve name MAPI function.
- DO getname.spr
- IF m.okbtn=2
- SET TALK &oldtalk
- RETURN
- ENDIF
- IF !mapilib('resolve',m.mailsession,newname)
- SET TALK &oldtalk
- RETURN
- ENDIF
-
- * Set field in screen.
- m.tonames=ALLT(mapirecip.name)
-
- * Call FoxPro screen
- DO sendmail.spr
-
- * Now cleanup after exiting screen.
- IF !islogon
- =mapilib('LOGOFF',m.mailsession)
- mailsession = 0
- ENDIF
- SET TALK &oldtalk
-
-
-
- *!*********************************************************************
- *!
- *! FUNCTION: btnval
- *!
- *!*********************************************************************
- * This procedure handles the MAPI buttons. The user can either
- * send a message or only save it in his/her inbox.
- FUNCTION btnval
- IF m.btn#3
- =mapilib('newcursor','mapiFile')
- =mapilib('newcursor','mapiMesg')
- INSERT INTO mapimesg VALUES(0,m.subject,m.notetext,'IPM.',;
- mapilib('getdate'),'',0,RECCOUNT('mapiRecip'),0)
- IF m.btn=1
- retval=mapilib("sendmail",m.mailsession,"mapiMesg","mapiRecip","mapiFile",0)
- ELSE
- retval=mapilib("savenote",m.mailsession)
- ENDIF
- IF !EMPTY(m.retval)
- WAIT WINDOW 'Message saved/sent successfully...' TIMEOUT 1
- ENDIF
- USE IN mapimesg
- USE IN mapifile
- ENDIF
- USE IN mapirecip
- CLEAR READ
- RETURN
-
-
- *!*********************************************************************
- *!
- *! FUNCTION: getname
- *!
- *!*********************************************************************
- * This function calls the address both to change the name of the
- * message recipient(s). This differs from the original address which
- * is checked through the resolve dialog.
- FUNCTION getname
- IF !mapilib("addbook",m.mailsession,1)
- RETURN
- ENDIF
- m.tonames=''
- SCAN
- m.tonames=m.tonames+ALLT(mapirecip.name)+'..'
- ENDSCAN
- SHOW GETS
- RETURN
-