Sign in to follow this  
Followers 0
GAM

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

2 posts in this topic

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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0