Windows Powershell script to read POP3 emails and look for emails with a certain subject

sedang Berlangsung Dipasang 2 minggu yang lalu Dibayar saat pengiriman
sedang Berlangsung Dibayar saat pengiriman

Create a windows powershell script. This must run under Windows 11.

The script will login to a POP3 mailbox and check for an email with a certain subject that is dated within a certain number of hours. The subject will be evaluated by "contains" matching.

The script will have static variables for server name, user, password, subject, maximum age.

The script will print debug messages to the console at each step as well as log this information to c:\temp\[login to view URL]

If it finds an email message matching the criteria, it will create a text file c:\temp\[login to view URL] otherwise it will create a text file c:\temp\failure.txt. Then that email will be deleted from the server. (note success and failure text files should be deleted at the beginning of the script to cleanup from the last run.)

I am not a powershell developer - I tried ChatGPT and Claude to write this and their stuff was buggy. If you know Powershell well, you can maybe save time by using their code as a starting point.

You should give me code that you have confirmed to work and you can test on a mailbox which contains a few emails. i.e. Sometimes the matching email will be the first one and sometimes it will be a subsequent one. You should test both of these scenarios.

Note that the Email date in the header will contain the timezone i.e. Date: 27 Apr 2024 08:46:54 -0600 and that this timezone may be different than the computer timezone. This is important in calculating the age of the message.

.NET Powershell

ID Proyek: #38044338

Tentang proyek

6 proposal Proyek online Aktif 2 minggu yang lalu