Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MSMapi
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Re: MSMapi
Divers
Thread ID:
00764896
Message ID:
00769000
Vues:
21
Thanks, Javier. I'll look at your code to see if it might work . . .


>Russell, I use this simple function MAPI and it works regardless of the address being in the address book. 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.
>
>
>
>>Thanks for the reply (the only one I received), but unfortunately what you refer me to is not a solution to the problem I'm having.
>>
>>Russell
>>
>>>Russell, perhaps this message will help:
>>>
>>>Re: Autosend email without annoying outlook message Thread #740746 Message #740748
>>>
>>>which is FAQ:
>>>
>>>How do I avoid the annoying Outlook dialog sending Outlook automation or MAPI email? FAQ #8155
>>>
>>>
>>>
>>>>I've got a control that sends e-mail for me using the MAPIMessages and
>>>>MAPISession objects. It has to work with addresses that are not necessarily
>>>>in the address book of the sender. If the recipient's address is not in the
>>>>sender's address book, the user gets an "Unknown Recipient". The user can
>>>>click Ok and the e-mail message will come up, but when it is actually sent,
>>>>it fails with a "Your message did not reach some of the intended recipients"
>>>>message. Please note that this is not a bounce back. Outlook must be
>>>>trying again to resolve the name against the address book and when it can't,
>>>>it just won't send it. So I located some documentation on how to build an
>>>>e-mail address that would pass muster without being in the address book.
>>>>
>>>>Basically the address had to have a format like this:
>>>>
>>>>
>>>><Name>[SMTP:<e-mail address>]
>>>>
>>>>
>>>>With an example being "Bob Smith[SMTP:bob.smith@thisnamedoesnotexist.com]"
>>>>(without the quotes, of course).
>>>>
>>>>Unfortunately, this is not working and now I can't find the document that
>>>>showed me how to format an address that will pass muster and be sent even if
>>>>it does not resolve to an entry in the address book. There must be a way to
>>>>do this, since it would be asinine to expect every address that e-mail might
>>>>be sent to to also be in the address book. I'm sure it's just a minor thing
>>>>to get it working, but I've tried little changes here and there and haven't
>>>>hit upon the right format. Does anyone know how to make this work?
>>>>
>>>>Thanks,
>>>>
>>>>Russell Campbell
eCost.com continues to rip people off
Check their rating at ResellerRatings.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform