Tutorial: Automate Yahoo Email Forwarding
Task: Automatically forward all emails from Yahoo to your other email account
1. Automate the login: YahooMacro1
This is what we recorded:
VERSION BUILD=300002
URL GOTO=http://www.yahoo.com/
SIZE X=870 Y=634
TAG TYPE=AREA ATTR=HREF:http://www.yahoo.com/r/m1
TAG TYPE=INPUT:TEXT FORM=NAME:login_form ATTR=NAME:login CONTENT=testuser
TAG TYPE=INPUT:PASSWORD FORM=NAME:login_form ATTR=NAME:passwd CONTENT=34BDED5D3829FBB2130114DC2F696DA2
TAG TYPE=INPUT:SUBMIT FORM=NAME:login_form ATTR=NAME:.save&&VALUE:Sign<SP>In
|
Problem: When we replay it to test it, it does not work.
Reason: Yahoo saved a cookie after the first recording that changes the start screen and confuses IIM
Solution: Add a CLEAR statement to delete this cookie:
VERSION BUILD=300002
CLEAR
URL GOTO=http://www.yahoo.com/
SIZE X=870 Y=634
TAG TYPE=AREA ATTR=HREF:http://www.yahoo.com/r/m1
TAG TYPE=INPUT:TEXT FORM=NAME:login_form ATTR=NAME:login CONTENT=testuser
TAG TYPE=INPUT:PASSWORD FORM=NAME:login_form ATTR=NAME:passwd CONTENT=34BDED5D3829FBB2130114DC2F696DA2
TAG TYPE=INPUT:SUBMIT FORM=NAME:login_form ATTR=NAME:.save&&VALUE:Sign<SP>In
|
2. After the login, automatically forward all emails: YahooMacro2
This is what we recorded:
VERSION BUILD=300002
URL GOTO=http://us.f148.mail.yahoo.com/ym/login?.rand=cohursisne3s5
SIZE X=870 Y=634
FRAME F=2
TAG TYPE=A ATTR=TXT:Inbox<SP>(75)
TAG TYPE=A ATTR=TXT:test<SP>
TAG TYPE=INPUT:SUBMIT FORM=NAME:frmCompose ATTR=NAME:FWD&&VALUE:Forward
TAG TYPE=INPUT:TEXT FORM=NAME:Compose ATTR=NAME:To CONTENT=fromyahoo@iopus.com
TAG TYPE=TEXTAREA FORM=NAME:Compose ATTR=NAME:Body CONTENT=Forward<SP>by<SP>iOpus<SP>Internet<SP>Macros
TAG TYPE=INPUT:SUBMIT FORM=NAME:Compose ATTR=NAME:SEND&&VALUE:Send
FRAME F=1
TAG TYPE=A ATTR=TXT:Check<SP>Mail
FRAME F=0
|
Now we see that the email was selected using the TEXT of the email. This is not what we like. So we re-record this part, but this time set the click mode to "Use URL" instead of automatic when selection this email.
VERSION BUILD=300002
URL GOTO=http://us.f148.mail.yahoo.com/ym/login?.rand=cohursisne3s5
SIZE X=870 Y=634
FRAME F=2
TAG TYPE=A ATTR=TXT:Inbox<SP>(75)
TAG TYPE=A ATTR=HREF:http://us.f148.mail.yahoo.com/ym/ShowLetter?MsgId=8831_269792_22024_ [cut long line]
TAG TYPE=INPUT:SUBMIT FORM=NAME:frmCompose ATTR=NAME:FWD&&VALUE:Forward
TAG TYPE=INPUT:TEXT FORM=NAME:Compose ATTR=NAME:To CONTENT=fromyahoo@iopus.com
TAG TYPE=TEXTAREA FORM=NAME:Compose ATTR=NAME:Body CONTENT=Forward<SP>by<SP>iOpus<SP>Internet<SP>Macros
TAG TYPE=INPUT:SUBMIT FORM=NAME:Compose ATTR=NAME:SEND&&VALUE:Send
FRAME F=1
TAG TYPE=A ATTR=TXT:Check<SP>Mail
FRAME F=0
|
Ok, we have re-record the macro and have the URL specific to this message.
What we want to do is to always select the first message.
VERSION BUILD=300002
URL GOTO=http://us.f148.mail.yahoo.com/ym/login?.rand=cohursisne3s5 (1)
SIZE X=870 Y=634
FRAME F=2
TAG TYPE=A ATTR=TXT:Inbox* (2)
TAGPOSITION POS=!LOOP (4)
TAG TYPE=A ATTR=HREF:http://*/ym/ShowLetter?MsgId=* (3)
TAG TYPE=INPUT:SUBMIT FORM=NAME:frmCompose ATTR=NAME:FWD&&VALUE:Forward
TAG TYPE=INPUT:TEXT FORM=NAME:Compose ATTR=NAME:To CONTENT=fromyahoo@iopus.com
TAG TYPE=TEXTAREA FORM=NAME:Compose ATTR=NAME:Body CONTENT=Forward<SP>by<SP>iOpus<SP>Internet<SP>Macros
TAG TYPE=INPUT:SUBMIT FORM=NAME:Compose ATTR=NAME:SEND&&VALUE:Send
FRAME F=1
TAG TYPE=A ATTR=TXT:Check<SP>Mail
FRAME F=0
|
(1) Remove the URL statement, as our Login-Macro already navigated us to this page
(2) Part of the text is the number of messages. Of course, this changes over time. So replace the number with "*".
(3) Replace the message specific characters in the attribute with "*" so IIM ignores them.
Result: Always the first message is selected and forwarded.
(4) We add a TAGPOSITION command to select the first, second,.... line with every new loop.
When we are done, an error occurs because IIM can no longer find messages. But this Ok, since we are done.
3. Once we are done, log off: YahooMacro3
VERSION BUILD=300002
URL GOTO=http://us.f148.mail.yahoo.com/ym/login?.rand=cohursisne3s5
SIZE X=937 Y=643
FRAME F=1
TAG TYPE=A ATTR=TXT:Sign<SP>Out
|
All we need to change is to remove the unnecessary URL statement.
VERSION BUILD=300002
URL GOTO=http://us.f148.mail.yahoo.com/ym/login?.rand=cohursisne3s5
SIZE X=937 Y=643
FRAME F=1
TAG TYPE=A ATTR=TXT:Sign<SP>Out
|
Now that we created the macros, IIM can automatically forward the emails for you.
How to run these macros:
4. Power Surfer Edition
Run YahooMacro1 to login, LOOP over YahooMacro2 and run YahooMacro3 to log off. Of course, you can create similar Macros for Hotmail, MSN and any other free email service as well.
5. PRO Edition
With the PRO Edition can can create a batch file that does everything for you:
echo YahooEmail *TRAY MODE*
REM Tip: You may have to adjust the path names to YOUR installation directory of iMacros
C:\IIM3\iimpro.exe -macro yahooemail1 -tray
C:\IIM3\iimpro.exe -macro yahooemail2 -tray -loop
C:\IIM3\iimpro.exe -macro yahooemail3 -tray
echo Batch file completed
pause
|
6. Scripting Edition
With the Scripting Edition you can do all this with the Windows Scripting Host or any other programming language, e. g. Visual Basic. Scripting also allows to to react on errors (e. g. if Yahoo email is unaccessible) in a very detailed way. A list of scripting examples that ship with IIM is available here.
See also: Automating Google Apps with iMacros
|