I was using the following code with windows 7 and everything was working, but when I use the same code on windows 10, it stopped working and gave me the error found below further down;
Code that used to work for me in windows 7:
pmsg := ComObjCreate("CDO.Message")
pmsg.From := """John Agius"" <something@gmail.com>"
pmsg.To := "somtehting@gmail.com"
pmsg.BCC := ""
pmsg.CC := ""
pmsg.Subject := "Message / Note"
pmsg.TextBody :=emailtosomeone
fields := Object()
fields.smtpserver := "smtp.gmail.com" ; specify your SMTP server
fields.smtpserverport := 465 ; 25
fields.smtpusessl := True ; False
fields.sendusing := 2 ; cdoSendUsingPort
fields.smtpauthenticate := 1 ; cdoBasic
fields.sendusername := "user@gmail.com"
fields.sendpassword := "password"
fields.smtpconnectiontimeout := 60
schema := "http://schemas.microsoft.com/cdo/configuration/"
pfld := pmsg.Configuration.Fields
For field,value in fields
pfld.Item(schema . field) := value
pfld.Update()
pmsg.Send()
In windows 10 it is giving me the following error;
Error: 0x800CCE05 Source: CDO.Message.1 Description: The requested body part was not found in this message HelpFile (Null) HelpContext: 0
Specifically from; ;bla bla bla working code -------> pmsg.From :="""John Agius"" "
Could someone please help me? I really need this to work for my job.
Thanks
John Agius