-1

Created a Python script that gets data from SQL Server, then writes the data to an Excel spreadsheet using Pandas and xlsxwriter. Then, the same script uses the win32 client library to send the newly created file via email from my Outlook address to certain recipients.

Now, since I need this to be fully automated, I attempted to have Windows Task Scheduler try to do this at a scheduled time. It creates the Excel sheet properly, but it fails to send the email. Oddly enough, if I run the Python script through a Python IDE, the entire process executes successfully without issue. I have verified that the email was sent and that I received it. The email neither sends nor do I receive it when using WTS.

Are there any work-arounds for this? Should I use a 3rd party task scheduler instead?

erik7970
  • 693
  • 1
  • 8
  • 21
  • Hello, Welcome to SO. Do consider asking a question as per guideline provided here : https://stackoverflow.com/help/how-to-ask . You need to provide relevant code for SO community to reproduce/debug your problem. – Anil_M Mar 30 '18 at 02:55
  • Which user is configured to execute the WTS task? – opperman.eric Nov 15 '21 at 22:18

1 Answers1

0

The Windows Task Scheduler has some problems, because you will probably not have enough rights to send an email. Try to manually deactivate and again activate the scheduled task in the WTS-program as an administrator, if that does not work, you will have to take a 3rd party task scheduler.