Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: jallitt on May 11, 2009, 10:29:00 PM
-
Is is possible to hook up a bit of VB to M5 to send me an email letting me know mach has finished?
I can think about 6 ways to make a linux machine send me an email - but windows and VB are a mystery...
-
I'm not sure under the Cypress flavor of VB that mach uses. It can call other libraries though. I would do some googling on sending email in VB script or VB 6. That should be pretty close. I have some code around somewhere for VB.NET that I used for an introductory class on VB. If I can find it I'll post it.
I just found lots of info searching for 'VBscript send email', here is one:
http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/enterprise/mail/
-
That looks similar to the code I found....
here's my new M5 script works when run manually - haven't tried it from a real job yet - obviously replace username, password, server, and email addresses. It's probably possible to omit the username and password but I don't have an email client setup on the computer running mach...
=====================
DoSpinStop()
Code "(sending mail)"
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "mach finished"
objMessage.Sender = "youremail@blah.com"
objMessage.To = "youremail@blah.com"
objMessage.TextBody = "mach finished."
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.server.com"
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
'objMessage.Configuration.Fields.Item _
'("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
'Your UserID on the SMTP server
'objMessage.Configuration.Fields.Item _
'("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"
'Your password on the SMTP server
'objMessage.Configuration.Fields.Item _
'("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
objMessage.Send
-
Here's an idea...
Just mount a cellphone to the table, and at the end of your program have the spindle stop and rapid over to the phone and dial your number. ;D
-
Neat idea ! :D
Would look good on YouTube too ! ;D
-
HAHAHA!!! I got a good laugh outta that one. Thanks.
-
;D
Brett