I have been reading the FAQs and with help from you guys I am slowly building up what little knowledge I have on automating Outlook and then using CDO and SMTP to create emails from within my app.
My first attempts worked on my desktop which shares it's internet connection, but not on my laptop which was using that shared connection. I then started using this code and it works fine here, but not on my colleagues site in the USA. After a while the penny dropped that it was getting stuck in the firewall.
Can anyone tell me what I need to do in order to allow the guys in the USA to set up some parameters to get through the firewall.
FUNCTION test_email()
PARAMETERS cSender, cECopies, cSubj, cMsg, cParam, cServer
Local iMsg,iConf
Declare SHORT InternetGetConnectedState In wininet.Dll;
INTEGER @lpdwFlags, Integer dwReserved
*Check for an active internet connection
lConnect=displayState()
* If we have a connection create and send the email
If lConnect
iMsg = Createobject("CDO.Message")
iConf = Createobject("CDO.Configuration")
Flds = iConf.Fields
With Flds
.Item(" = 2
.Item(" = cServer
.Item(" .Update
Endwith
With iMsg
.Configuration = iConf
.To = cRecipient
.CC = cECopies
.BCC = ""
.From = cSender
.Subject = cSubj
.TextBody = cMsg
.Send
Endwith
iMsg = .Null.
iConf = .Null.
wb = .Null.
ELSE
IF cParam != 2 .or. cParam != 4
Messagebox("Could not send the message, your internet connection is down.")
ENDIF
ENDIF
Procedure displayState
Local lConnected
lConnected = .F.
lpdwFlags = 0
If InternetGetConnectedState (@lpdwFlags, 0) = 1
lConnected = .T.
Endif
Return lConnected
Thanks in advance.
My first attempts worked on my desktop which shares it's internet connection, but not on my laptop which was using that shared connection. I then started using this code and it works fine here, but not on my colleagues site in the USA. After a while the penny dropped that it was getting stuck in the firewall.
Can anyone tell me what I need to do in order to allow the guys in the USA to set up some parameters to get through the firewall.
FUNCTION test_email()
PARAMETERS cSender, cECopies, cSubj, cMsg, cParam, cServer
Local iMsg,iConf
Declare SHORT InternetGetConnectedState In wininet.Dll;
INTEGER @lpdwFlags, Integer dwReserved
*Check for an active internet connection
lConnect=displayState()
* If we have a connection create and send the email
If lConnect
iMsg = Createobject("CDO.Message")
iConf = Createobject("CDO.Configuration")
Flds = iConf.Fields
With Flds
.Item(" = 2
.Item(" = cServer
.Item(" .Update
Endwith
With iMsg
.Configuration = iConf
.To = cRecipient
.CC = cECopies
.BCC = ""
.From = cSender
.Subject = cSubj
.TextBody = cMsg
.Send
Endwith
iMsg = .Null.
iConf = .Null.
wb = .Null.
ELSE
IF cParam != 2 .or. cParam != 4
Messagebox("Could not send the message, your internet connection is down.")
ENDIF
ENDIF
Procedure displayState
Local lConnected
lConnected = .F.
lpdwFlags = 0
If InternetGetConnectedState (@lpdwFlags, 0) = 1
lConnected = .T.
Endif
Return lConnected
Thanks in advance.