Jump to content
Sign in to follow this  
hein123

How To Do Task According To Email

Recommended Posts

hein123

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

Share this post


Link to post
Share on other sites
Juvigy

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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.