Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: jallitt on May 11, 2009, 10:29:00 PM

Title: Any way I can get Mach to send me an email when it's finished?
Post 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...
Title: Re: Any way I can get Mach to send me an email when it's finished?
Post by: Jeff_Birt on May 12, 2009, 09:29:38 AM
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/
Title: Re: Any way I can get Mach to send me an email when it's finished?
Post by: jallitt on May 12, 2009, 08:38:27 PM
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

Title: Re: Any way I can get Mach to send me an email when it's finished?
Post by: radioactive on May 13, 2009, 10:37:02 AM
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
Title: Re: Any way I can get Mach to send me an email when it's finished?
Post by: Overloaded on May 13, 2009, 11:00:21 AM
Neat idea !  :D
Would look good on YouTube too ! ;D
Title: Re: Any way I can get Mach to send me an email when it's finished?
Post by: Sam on May 13, 2009, 09:26:45 PM
HAHAHA!!! I got a good laugh outta that one. Thanks.
Title: Re: Any way I can get Mach to send me an email when it's finished?
Post by: Chaoticone on May 13, 2009, 09:36:03 PM
 ;D

Brett