Is there code that can be added to my Visual FoxPro program so that the mail server will send an email notification that the email was deliveried?
procedure deliver_mail
if empty(m.subject) .or. empty(m.text) .or. empty(m.recipient)
wait window "Missing Email Header Data... Program Will Exit" timeout 1
return
else
***** Memory Variable Setup For Automatic Email
mprofile = "Microsoft Outlook" && Email Profile
***************************************************
*Create a MAPI Session object then Logon. The Logon dialog can be
*bypassed by providing a valid ProfileName as the first parameter
*(as a string) to the Logon Method as seen below.
objSession = CREATEOBJECT("mapi.session"
objSession.Logon(mprofile)
*Create a new message in the Outbox and populate a few basic properties
objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = m.subject
objMessage.Text = m.text
*Add an attachment (assumes "myfile.doc" exist in c:\)
if empty(m.attachment1)
Wait Window " No Attachment To Send...." nowait
else
Wait Window "Attachments Will Be Sent...." nowait
objMessage.Attachments.Add(m.attachment1, 0, 1, m.attachment1)
objMessage.Attachments.Add(m.attachment2, 1, 1, m.attachment2)
endif
*Add a Recipient to the message we just created and resolve
objRecip = objMessage.Recipients.Add(m.recipient) && who it's to
objRecip.Resolve
*Send it
objMessage.Send
*Clean up then bail
objSession.Logoff
RELEASE objRecip, objMessage, objSession
endif
Thanks,
DHart
procedure deliver_mail
if empty(m.subject) .or. empty(m.text) .or. empty(m.recipient)
wait window "Missing Email Header Data... Program Will Exit" timeout 1
return
else
***** Memory Variable Setup For Automatic Email
mprofile = "Microsoft Outlook" && Email Profile
***************************************************
*Create a MAPI Session object then Logon. The Logon dialog can be
*bypassed by providing a valid ProfileName as the first parameter
*(as a string) to the Logon Method as seen below.
objSession = CREATEOBJECT("mapi.session"
objSession.Logon(mprofile)
*Create a new message in the Outbox and populate a few basic properties
objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = m.subject
objMessage.Text = m.text
*Add an attachment (assumes "myfile.doc" exist in c:\)
if empty(m.attachment1)
Wait Window " No Attachment To Send...." nowait
else
Wait Window "Attachments Will Be Sent...." nowait
objMessage.Attachments.Add(m.attachment1, 0, 1, m.attachment1)
objMessage.Attachments.Add(m.attachment2, 1, 1, m.attachment2)
endif
*Add a Recipient to the message we just created and resolve
objRecip = objMessage.Recipients.Add(m.recipient) && who it's to
objRecip.Resolve
*Send it
objMessage.Send
*Clean up then bail
objSession.Logoff
RELEASE objRecip, objMessage, objSession
endif
Thanks,
DHart