Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Send email via scripting
PostPosted: Wed Feb 08, 2012 3:29 pm 

Joined: Tue Jan 17, 2012 8:57 am
Posts: 19

Offline
I have some script that collects general health information from our machine that I would like to be able to email. The only method I've seen for sending emails is through the alarm server. I'm fine with this, but is there a way to create a "dummy" alarm that I can use as a pass-through to send my actual email text that will reset itself so I can use it again later for another email?

_________________
Bob Livingston
Sr Controls Engineer
FlexEnergy Energy Systems
30 New Hampshire Ave
Portsmouth, NH 03801
USA


 Profile  
 
 Post subject: Re: Send email via scripting
PostPosted: Wed Feb 08, 2012 4:40 pm 

Joined: Wed Jan 04, 2012 11:17 am
Posts: 42

Offline
Bob,

There is a handy way to send emails with a script, and you can send whatever data you want. The script can even utilize the settings you already have configured in your alarm settings.

I have attached a sample project that demonstrates the functionality.


Attachments:
Script_Email.zip [108.47 KiB]
Downloaded 513 times

_________________
Best Regards,

Beijer Electronics, Inc.
Skylar Walker | Applications Engineer
 Profile  
 
 Post subject: Re: Send email via scripting
PostPosted: Thu Feb 09, 2012 3:27 pm 

Joined: Tue Jan 17, 2012 8:57 am
Posts: 19

Offline
Thanks Skylar.

Another related question - I've created a dialog to manage the SMTP server settings, but the settings are lost during a power cycle. What do I need to call to save the new server settings?

_________________
Bob Livingston
Sr Controls Engineer
FlexEnergy Energy Systems
30 New Hampshire Ave
Portsmouth, NH 03801
USA


 Profile  
 
 Post subject: Re: Send email via scripting
PostPosted: Fri Feb 10, 2012 10:23 am 

Joined: Tue Jan 17, 2012 8:57 am
Posts: 19

Offline
After some digging, I found I could save the config. settings using
Neo.ApplicationFramework.Common.XmlTypeSerializer.Save<IEmailDevice>(Path.Combine(ExecutionPath, "EmailDevice1.xml"), Globals.EmailDevice1);

I've tried to send an email through the Beijer, but I get the following error message: "Email could not be delivered due to Connection error". I have checked my SMTP server settings and they are correct. Is there something I am missing? (I'm using the example script above.)

Thanks.

_________________
Bob Livingston
Sr Controls Engineer
FlexEnergy Energy Systems
30 New Hampshire Ave
Portsmouth, NH 03801
USA


 Profile  
 
 Post subject: Re: Send email via scripting
PostPosted: Fri Feb 10, 2012 11:28 am 
User avatar

Joined: Fri Jul 15, 2011 3:21 pm
Posts: 214

Offline
Could be a fire wall issue, if you are testing the application on your PC, you can run the freeware program WireShark and view exactly what is happening on the network. Most likely you would see an attempt of a TCP/IP connection to your SMTP server that was rejected or a DNS request that failed to translate the SMTP server name to an IP address.

_________________
Best Regards,

Beijer Electronics, Inc.
Ron Lloyd | Applications Engineer


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: