Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
E-mail without automation
Message
De
12/03/2003 10:17:57
 
 
À
04/03/2003 10:03:13
N. Lea
Nic Cross Enterprises
Valencia, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00760873
Message ID:
00764780
Vues:
37
If you want to use MAPI try this simple function that works with any MAPI compliant program (not just Outlook).
Hope it helps.
******************************************************************************
*-- Sends a mail through MAPI.
*-- Parameter cAttach has to be a full path file name.
******************************************************************************
function sendMAPIMail(cSubject, cBody, cRecipient, cAttach)
local lcDirectory, loMAPISession, loMAPIMessage

do case
case pCount() < 3
	*-- Include here your favorite message
	return .f.
case pCount() < 4
	cAttach = ''
endcase

*-- The MAPI server can change the directory if it has to be initialized
lcDirectory = set('directory')

loMAPISession = createObject('MSMAPI.MAPISession.1')
loMAPIMessage = createObject('MSMAPI.MAPIMessages.1')

*-- Signon procedure
with loMAPISession
	.Signon()
	*-- Checks that the session has been initialized, and assigns the id
	*-- to the message object
	if (.SessionID > 0)
		loMAPIMessage.SessionID = .SessionID
	else
		wait window "Could not initalize MAPI session"
		return
	endif
endwith

*-- Sends the message
with loMAPIMessage
	.Compose()

	.RecipDisplayName = allTrim(cRecipient)
	.RecipType = 1
	.ResolveName()

	.MsgSubject = allTrim(cSubject)
	.MsgNoteText = allTrim(cBody)
	
	*-- Attach the file to the message. You can attach several files
	*-- by only adding a FOR...ENDFOR that loops through the files
	*-- in the attach string, or yu can modify the function to pass
	*-- an array of file names
	if NOT isBlank(cAttach) AND file(cAttach)
		.AttachmentIndex = loMAPIMessage.AttachmentCount
		.AttachmentName = right(cAttach, len(cAttach) - rat('\', cAttach))
		.AttachmentPathName = cAttach
	endif

	.Send(.f.)
 endwith

loMAPISession.Signoff()
set directory to (lcDirectory)

return .t.
>Hi there! Does anyone know how I would send an e-mail through my own e-mail window form using MAPI without using automation.
>The main problem is whether people or not will have Outlook installed on their computer, in addition, sometimes Outlook has this problem with
>not sending the mail unless you open their problem and send it manually.
>
>Thanks for any input!!
>
>Never Underestimate Radical Vision
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform