sending trend per email

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
wlederer
Posts: 175
Joined: Fri Jan 27, 2012 4:20 am

sending trend per email

Post by wlederer »

The task is to send per email the csv file with trend.
As example the script ExportTrendData was taken. The file name must be a combination of data in a TextBox on the screen (ship's name) and the current date.
public string ExportTableToCSV(string tableName)
{
string trendDataCSVFileName=Path.Combine("HardDisk",Globals.Tags.ShipsName.Value.ToString()+" "+DateTime.Today.ToString("D")+".csv");
//a new tag TrendAttachmentFileName was created and valued
Globals.Tags.TrendAttachmentFileName.Value=trendDataCSVFileName
}
Actually, it works. A trend data file with a proper name is being written to a USB stick attached to the panel. But how can I send the file per email?
I tried another script, the MailScriptModule. It send emails, but without the file.

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

Re: sending trend per email

Post by Skylar »

Take a look at the example script "MailScriptModule" again... I think what you want to do is add your file as an attachment. If you look, the "MailScriptModule" actually creates a file and then attaches is to the email. You would just need to modify it to send your file instead. Either that, or make the message body part of the email contain your information.
Best Regards,

Beijer Electronics, Inc.
Skylar Walker | Applications Engineer

wlederer
Posts: 175
Joined: Fri Jan 27, 2012 4:20 am

Re: sending trend per email

Post by wlederer »

It works now. I only had to remove part of the code which deleted the file I wanted to be sent and created a dummy attachment instead. Thank You.

User avatar
Chris T.
Posts: 109
Joined: Mon Nov 20, 2017 5:29 pm

Re: sending trend per email

Post by Chris T. »

Best regards,
Christopher
(801) 708-6690
Technical Support
Contact Us

Beijer Electronics AB
http://www.beijerelectronics.us

Post Reply