I was trying to get PI Notifications to send an email every day with an Excel spreadsheet attachment. I configured a report template in Excel and then used PI Datalink to update the various values for the past 24 hours. The intent being to send out the updated spreadsheet out every day without me having to manually send it.
PI Notifications 2012 seems to only allow emails to have a static attachment added to the message template or a link to a file. For example, if I attach Monday's report to the message template, the new report on Tuesday is not attached to the automated email. All daily emails have Monday's report. I also encountered access and permissions problems for the people who received this report, as they don't have access to the folder location where the spreadsheet lives.
I was able to find a solution for this using a Windows VBS script, which I found on this website VBScript To Send Email Using CDO
There are a couple of different email scripts on this webpage, however I used this one as it uses authentication.
Const cdoSendUsingPickup = 1
Const cdoSendUsingPort = 2 'Must use this to use Delivery Notification
Const cdoAnonymous = 0
Const cdoBasic = 1 ' clear text
Const cdoNTLM = 2 'NTLM
'Delivery Status Notifications
Const cdoDSNDefault = 0 'None
Const cdoDSNNever = 1 'None
Const cdoDSNFailure = 2 'Failure
Const cdoDSNSuccess = 4 'Success
Const cdoDSNDelay = 8 'Delay
Const cdoDSNSuccessFailOrDelay = 14 'Success, failure or delay
set objMsg = CreateObject("CDO.Message")
set objConf = CreateObject("CDO.Configuration")
Set objFlds = objConf.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.yourhost.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "your-username"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "your-password"
strBody = "This is a sample message." & vbCRLF
strBody = strBody & "It was sent using CDO." & vbCRLF
Set .Configuration = objConf
.To = "email@example.com"
.From = "firstname.lastname@example.org"
.Subject = "This is a CDO test message"
.TextBody = strBody
'use .HTMLBody to send HTML email.
.Fields("urn:schemas:mailheader:disposition-notification-to") = "email@example.com"
.Fields("urn:schemas:mailheader:return-receipt-to") = "firstname.lastname@example.org"
.DSNOptions = cdoDSNSuccessFailOrDelay
After I modified this script for my email server and user accounts, it worked the very first time. A nice work around that does not require any third party software.