Does Your 3D Printer Tweet?
Get an email, text or Tweet from your 3D printer lately? No, why not? Well, OK, it’s not REALLY from your printer but it’s still pretty handy to get a notice when that print job is done if you’re not sitting there babysitting it.
Or Email or Text?
If you’re using PronterFace or any other PC based printer control that supports external commands you can easily get email or text notifications when print jobs are done or if there is an error. In fact with some free email to Twitter options such as TwitterMail.com you can put your 3D printer online and have it Tweet when it’s done.
This will cover how to do this on a Windows machine for the details but Linux gurus can easily replicate the end results I’m sure.
PronterFace has an option under the Settings / Options menu item and the External Commands tab to run external programs for printer start, printer final, and printer error situations. With this we can run any program we want to for our purposes we will use some simple VBScript to make it happen. This could just as easily be done in PowerShell if you’re a PS expert.
First we need ability to use an SMTP server somewhere. If you have an account with SMTP.com or are running your own SMTP server somewhere then it’s easy. For a local SMTP server just ensure the IP you’re PC is using is able to send email through the server if local and make sure you know a valid username and password for either option.
You can even use Gmail to send the messages if you desire but it takes a little bit more and lessens the security on your Gmail account. If you want or need to use Gmail it might be best to create another GMail account just for this to insure your main account doesn’t have any other risk. The reason is that you do need to lower the security level for “Less Secure Devices” after you log into the Gmail account by visiting this link and making the change: https://www.google.com/settings/security/lesssecureapps. Additionally you will have to store the email password for the gmail account in open text in the script which is obviously not good either. Once you turn ON access for less secure apps, our script can then send email through that Gmail account.
Once you have an SMTP server accessible then the rest is rather simple. We can setup the following command in the PronterFace or other print controller to run your .VBS script to email the notice. In PronterFace your external command should be like this: “Cscript.exe C:\3Dprinting\SendEmail.vbs” where the path is where ever you put the VBS script from below. The script is a little messier with the TLS requirements vs if you run your own email server and can simply whitelist the IP of the host computer but either works.
Super easy way with your own SMTP or use something simpler like SMTP.com:
Set Arg = Wscript.Arguments If arg.count > 0 then strJob = arg.item(0) SendEmail “WhoTo@from.com”, “Gray Hair 3D printer just finished print job “ & strJob Sub SendEmail(ToAddress, Subject, Text) Set MyEmail=CreateObject("CDO.Message") MyEmail.Subject=Subject MyEmail.From=”MrWallace@Protowrxs.com” ‘ Whatever you want/need the FROM to be MyEmail.To=ToAddress MyEmail.TextBody=Text MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 'SMTP Server MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="
" 'SMTP Port MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 MyEmail.Configuration.Fields.Update MyEmail.Send set MyEmail=nothing End Sub
More Complicated when using GMail:
Set Arg = Wscript.Arguments If arg.count > 0 then strJob = arg.item(0) ‘Call the sub like this 'SendEmail "
", " ", " " SendEmail “WhoTo@from.com”, “Gray Hair 3D printer just finished print job “ & strJob Sub SendEmail(ToAddress, Subject, Text) Dim iMsg Dim iConf Dim Flds Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") iConf.Load -1 Set Flds = iConf.Fields With Flds .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = " @Gmail.com" .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = " " .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" 'smtp mail server .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 'stmp server .Update End With With iMsg Set .Configuration = iConf .To = ToAddress .From = " @Gmail.com" .Subject = Subject .TextBody = Text .Send End With Set iMsg = Nothing Set iConf = Nothing End Sub
Tweeting Your Print Info using TwitterMail.comYou can have your printer Tweet when it’s done as well by using the free Twittermail.com or TwitterCounter.com service.
Visit the http://www.TwitterMail.com site and login with your Twitter credentials. Once logged in go to the Settings / TwitterMail option and you’ll see a unique @Twittermail.com email address that can be emailed to in order to Tweet something. Then you can simply email to that @twittermail.com email address to Tweet your printer message.
Post a Comment