I have an application that creates a DBF and then sends it via E-mail to a recipient. It worked great in testing sending it to myself. The only documentation I have is from an "Inside Visual FoxPro" article from last September. Anyway, it appears that the attachment isn't actually being sent. Instead, a link or shortcut gets sent. If you happen to have the attachment on your system, like I did during testing, you don't see the problem. Here's my code:
IF TYPE('oSession') <> 'O'
oSession = CREATEOBJECT('MAPI.Session')
oSession.Logon("Windows Messaging Settings",.f.)
ENDIF
oMessage = oSession.OutBox.Messages.Add()
oMessage.Subject = cEmailSubject
oMessage.Text = cEmailText
oAttach = oMessage.Attachments.Add()
oAttach.Type = 2
oAttach.Source = cAttachSource
oAttach.Name = cAttachName
oRecipient = oMessage.Recipients.Add()
WITH oRecipient
.Name = TRIM(MadHatter.cEmail)
.Address = 'SMTP:'+TRIM(MadHatter.cEmail)
.AddressEntry.Type = "SMTP"
.AddressEntry.Address = TRIM(MadHatter.cEmail)
ENDWITH
oMessage.Update()
oMessage.Send(.T.,.F.)
cAttachSource is a pathname to the file. cAttachName is just the file name. I have tried using the full pathname here, but that doesn't work either.
Of course I am in a MAJOR rush here. What am I doing wrong and how can I fix it in the next few minutes :-)
Thanks,
Paul