;Set sFileName to the name of the file you wish to attach ;Replace Entry_Name with the name of the Connection Directory mail entry that you wish to send mail to ;Replace "Message subject" with the subject you would like your email to have ;Replace "Message text" with the text you would like in the body of your email ;Some timing changes may be needed before the winactivate if the sending account will also be receiving email ;After the winactivate command, you will need to perform any necessary tasks to work around any possible problems that may occur if your script cannot successfully send the email proc main string sCurrentDialog ;String to hold caption of current dialog/window string Msg = "Sending New Messages" ;Caption of sending dialog integer iRC ;Integer to hold result code of strcmp command string sFileName ;String containing name of file to attach dial MAIL "Entry_Name" ;Create email message sendkeystr "Message subject" ;Set mail subject sendkey ALT 'M' ;Open Message menu mspause 250 sendkey 'A' ;Open Add Attachment dialog sendkeystr sFileName ;Attach ZIP file mspause 250 sendkey ALT 'O' ;Close Add Attachment dialog mspause 250 sendkey 0x09 ;Send tab key to move focus to message body sendkeystr "Message text" ;Send text of message to compose window sendkey ALT 'M' ;Open Message menu mspause 250 sendkey 'M' ;Select Send Message menu item mspause 250 sendkey ALT 'A' ;Open main Message menu mspause 250 sendkey 'S' ;Select Send and Receive menu item wintext $ACTIVEWIN sCurrentDialog ;Get caption of current window strcmp sCurrentDialog Msg iRC ;Compare with known text of sending dialog while 1 ;Loop while sending dialog is up yield wintext $ACTIVEWIN sCurrentDialog strcmp sCurrentDialog Msg iRC if (iRC != 0) ;Exit while loop when sending dialog goes away exitwhile endif endwhile pause 10 ;Pause for a bit before checking for existence of error window, nasty bug requires this long wait if winactivate "Error Window" ;If mail error window is detected sendkey 0x20 ;Send space to close the window ;Do any necessary processing to resolve email transmission problem! endif endproc