Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88809

Outlook error when sending more than one mail: "The item has been moved or deleted"

$
0
0
for i in processed_corpus:
  for j in i:
     if j == "pricing" or j == "price" or j == "quote" or j =="quotation":
        mail.To = "abc@xyz.com"
        mail.Subject = message.Subject
        mail.Body = message.Body + "Belongs To Pricing"
        mail.Send()
        # print("Belongs to Pricing")
        # print("**************")
        # print(j)
        worksheet.write(row,col +4,"Pricing")
        ram=1
     elif j == "service" or j=="request" or j=="servicerequest":
        mail.To = "abc@xyz.com"
        mail.Subject = message.Subject
        mail.Body = message.Body + "Belongs To Service Request"
        mail.Send()
        # print("Belongs to servicerequest")
        # print("**************")
        # print(text_corpus)
        # print(j)
        worksheet.write(row, col + 4, "Service Request")
        ram=1
if(ram==0):
    #print("nothing")
    worksheet.write(row, col + 4, "Category Not Defined")
     # else:
     #    print("Belongs to nothing")
     #    print("**************")
     #    worksheet.write(row, col + 4, "Category Not Defined")

row = row + 1
message = lastHourMessages.GetNext()
wb.save("C:\\Users\\Innovation\\Desktop\\Demo_Format.xls")`

This is the error I'm getting:

Traceback (most recent call last):

File "28/11/2k19.py", line 81, in <module>
     mail.To = "abc@xyz.com"
File "venv\lib\site-packages\win32com\client\dynamic.py", line 549, in __setattr__
     self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value) 
     pywintypes.com_error: (-2147352567, 'Exception occurred.', 
         (4096, 'Microsoft Outlook', 'The item has been moved or deleted.',
                None, 0, -2147221238),
     None)

Viewing all articles
Browse latest Browse all 88809

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>