Get implementation code for the MapiSendMail class here.
Based on Simple MAPI functions this Custom class allows sending email messages from your default email client to multiple recipients with file attachments.
#DEFINE cret Chr(13)+Chr(10)#DEFINE dret cret+cret
PRIVATE obj
obj = CreateObject("MapiSendMail")WITH obj
* though the Sender object is implemented I never managed to make it * something else but the default address for the local email client
.AddSender("A.A.", "someone@somwhere.mail") * add one or more recipients * note that the following ones will not work, just an example
.AddRecipient("Chivas Regal", "info@chivasregal.mail")
.AddRecipient("Jim Beam", "info@.jimbeam.mail")
.AddRecipient("John Walker", "info@.johnwalkermail")
.AddRecipient("Canadian Club", "info@.canclubmail")
.MsgSubject = "Test Message"
.MsgBody ="This text will be put into body of your message." + dret +;
"You can also use table fields and Text and Edit Boxes." + dret +;
"Source:" + cret +;
"http://www.news2news.com/vfp" * adding file attachments * make sure that all files are available
.AddAttachment("C:\myfiles\Resume\cover.txt")
.AddAttachment("C:\myfiles\Resume\cv.doc")
.AddAttachment("C:\myprogs\sample.PRG")
.SndMessageENDWITH
Although the Sender object is presented, it may not be properly recognized by the MAPI. In my tests, the Sender was always the default address of the local email client regardless of a value assigned.
Prior to invoking MAPISendMail, ensure accessibility of all files to be attached.
This class does not use MAPILogon and MAPILogoff functions (hSession=0). In this case -- it is called an implicit logon -- the MAPI session is of temporary type. An implicit session gets closed by the time the call returns.
Tested on Windows XP Home Edition, Outlook Express 6.
Credits: PHP (4.4.9), an HTML-embedded scripting language,
MySQL (5.1.55-log), the Open Source standard SQL database,
AceHTML Freeware
Version 4, freeware HTML Editor of choice. Hosted by Korax Online Inc.