Jump to content

Receive a mail, read it and then delete it from outlook


GAM
 Share

Recommended Posts

Hi,

I am writing Autoit script to send a mail, wait till its received, read it and then delete it. The objecttive here is to know how to confirm that I have received this email and read it and delete it. Am from a security company so I'm automating the outlook scanning for all the emails. The task is...

1) Send a mail

2) Wait till I receive that mail.

3) Read it

4) Delete it.

Note : I'm running the automation from the machine where am sending and receiveing the mail. (I'm sending the mails to self)

I have written for 'sending a mail' and this works fine, please find below the code. But am not able to write the code for the above steps 2) , 3) and 4).

Can somebody help please?

---------------------------- CODE FOR SENDING A MAIL ----------------------------

$File_path = "Path of the attachment"

Func SendAndReadMail($File_path)

$Outlook = ObjCreate('Outlook.Application')

$mail = $Outlook.CreateItem(0)

$mail.Recipients.Add("agovada@ex2k.com")

$mail.Body = $File_path

$mail.Subject = $File_path

$mail.Attachments.Add($File_path)

$mail.Send

EndFunc

--------------------------------------------------------

Neil

Link to comment
Share on other sites

Please have a look at my OutlookEX UDF (please see my signature).

You could use function _OL_ItemFind to check for unread mails, then use Outlook method "Display" (there is no function available yet) and delete the mail using function _OL_ItemDelete.

Another approach can be found in the example scripts thread. The example there waits fo a new mail to arrive and then processes this mail.

If you need any assistance just psot your question.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...