Jump to content

How To Do Task According To Email


hein123
 Share

Recommended Posts

Hi,

I would like to do a few task's, particularly trade on a MT4 platform, according to instructions send to my machine, via gmail or any other online email account.

What I would like to find out is:

1. When a new email comes in, check the header.

2. If the header is a certain heading, then open the email.

3. The load the contents of the email to AutoIt for processing

The rest I can do myself (I hope)

Any advice would be appreciated

Regards

Hein

Link to comment
Share on other sites

You can check for new mail like this:

$oOApp = ObjCreate("Outlook.Application")
$test=ObjEvent($oOApp,"oOApp_")

sleep(1111111)
$oOApp=0
$test=0

Func oOApp_NewMail()
MsgBox(0,"test","test")
EndFunc

You can load the subject and the body using the outlook .subject and .body properties.

For reference check out the outlook object model on the MSDN .There are a lot of mail

examples on the forum too.

@EDIT

Just saw that you want to use gmail - then it is completely different scenario - will have to use the IE.udf

The examples above rely on the outlook object model

Here is a sending example showing the use of the .subject and .body properties.

Local $olMailItem = 0
    Local $olFormatRichText = 3
    Local $olImportanceLow = 0
    Local $olImportanceNormal = 1
    Local $olImportanceHigh = 2
    Local $olByValue = 1
    Local $olFormatHTML = 1
    $oOApp = ObjCreate("Outlook.Application")
    $oOMail = $oOApp.CreateItem ($olMailItem)
    $oOMail.Save
    With $oOMail
        .To = ("mail account")
        .Subject = "some subject"
        .BodyFormat = $olFormatHTML
        .Importance = $olImportanceNormal
        .HTMLBody = "some body"
        ;.attachments.add ($FileName3)
        .Send
        
    EndWith
Edited by Juvigy
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...