Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send an email 1

Status
Not open for further replies.

Mpking

Technical User
Mar 2, 2002
23
US
You guys did so great with my last question, here's one more.

Assuming my Procomm machine is connected to the network, and I configure the mail settings,

Is there a way to cause a script to send an email? (Could be blank, just would need the subject line)
 
There's not a direct ASPECT command to send an email, but you can workaround this by using the sendkey and sendkeystr command. Here's a procedure from a script I wrote a while back that illustrates the process. It may be a little more than you need for your case since it also scripts adding an attachment to the mail message, but you can take that code out if necessary.

proc mailforward ;Procedure to email received faxes, requires FaxForward entry in Connection Directory
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

dial MAIL "FaxForward" ;Create email message
sendkeystr "Forwarded fax file" ;Set mail subject
sendkey ALT 'M' ;Open Message menu
mspause 250
sendkey 'A' ;Open Add Attachment dialog
sendkeystr sFullZipName ;Attach ZIP file
mspause 250
sendkey ALT 'O' ;Close Add Attachment dialog
mspause 250
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
if winactivate "Error Window" ;If mail error window is detected
sendkey 0x20 ;Send space to close the window
<DO ANY NECESSARY ITEMS IF MAIL FAILS>
endif
endproc
 
Thanks guys the script what u have given is working fine with me and i am able to send mails using procomm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top