Page 1 of 1

sending trend per email

Posted: Fri Mar 02, 2012 4:42 am
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.

Re: sending trend per email

Posted: Fri Mar 02, 2012 10:21 am
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.

Re: sending trend per email

Posted: Thu Mar 08, 2012 6:27 am
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.

Re: sending trend per email

Posted: Tue Jan 21, 2020 6:21 pm
by Chris T.