Hi,
I seem to be having a problem sending an attachment as a 'variable" and not a literal. When I send it as a literal, it works perfectly. When I assign a variable to the filename I want to send, it gives me an error.
Here is the simple codeline:
STORE SYS(5)+CURDIR()+ALLTRIM(m.aname) TO m.faname
Local iMsg,iConf
Declare SHORT InternetGetConnectedState In wininet.Dll;
INTEGER @lpdwFlags, Integer dwReserved
lConnect=displayState()
If lConnect
iMsg = Createobject("CDO.Message")
iConf = Createobject("CDO.Configuration")
Flds = iConf.Fields
With Flds
.Item(" = 2
.Item(" = '???.???.??.?' &&Brutus
.Item(" = 25
.Update()
Endwith
With iMsg
.Configuration = iConf
.To = "me@me.com"
.CC = ""
.BCC = ""
.From = "Byou@you.ca"
.Subject = "Weekly CDR's"
.Fields("Priority").Value = 0 && -1=Low, 0=Normal, 1=High
.Fields.Update()
.HTMLBody = "Hi,<BR>"+"<BR>Attached you will find your Weekly CDR's.<BR><BR>"
.AddAttachment =m.faname &&&&&& THIS IS WHERE IT CRASHES !!
.Send()
Endwith
iMsg = .Null.
iConf = .Null.
Flds = .Null.
Else
Messagebox("Could not send the message, your internet connection is down.")
Endif
Procedure displayState
Local lConnected
lConnected = .F.
lpdwFlags = 0
If InternetGetConnectedState (@lpdwFlags, 0) = 1
lConnected = .T.
Endif
Return lConnected
Endproc
I seem to be having a problem sending an attachment as a 'variable" and not a literal. When I send it as a literal, it works perfectly. When I assign a variable to the filename I want to send, it gives me an error.
Here is the simple codeline:
STORE SYS(5)+CURDIR()+ALLTRIM(m.aname) TO m.faname
Local iMsg,iConf
Declare SHORT InternetGetConnectedState In wininet.Dll;
INTEGER @lpdwFlags, Integer dwReserved
lConnect=displayState()
If lConnect
iMsg = Createobject("CDO.Message")
iConf = Createobject("CDO.Configuration")
Flds = iConf.Fields
With Flds
.Item(" = 2
.Item(" = '???.???.??.?' &&Brutus
.Item(" = 25
.Update()
Endwith
With iMsg
.Configuration = iConf
.To = "me@me.com"
.CC = ""
.BCC = ""
.From = "Byou@you.ca"
.Subject = "Weekly CDR's"
.Fields("Priority").Value = 0 && -1=Low, 0=Normal, 1=High
.Fields.Update()
.HTMLBody = "Hi,<BR>"+"<BR>Attached you will find your Weekly CDR's.<BR><BR>"
.AddAttachment =m.faname &&&&&& THIS IS WHERE IT CRASHES !!
.Send()
Endwith
iMsg = .Null.
iConf = .Null.
Flds = .Null.
Else
Messagebox("Could not send the message, your internet connection is down.")
Endif
Procedure displayState
Local lConnected
lConnected = .F.
lpdwFlags = 0
If InternetGetConnectedState (@lpdwFlags, 0) = 1
lConnected = .T.
Endif
Return lConnected
Endproc