E-Mail File Statement
This article document the result structure required to use the Import/Export system to E-Mail a file.
Emailing a file requires six columns:
E-Mail Type ID
Type type of E-Mail Template to use (Generally "4")
To Email Address
DataSet containing a list of E-Mail addresses.
Merge Value
DataSet containing values for each Merge Field.
Bcc Email Address
Semi-Colon separated listing of BCC E-Mail addresses.
Attachment Path
Directory of the Attachment
Attachment File Name
File name of the desired file to be attached.
Sample SELECT Command and output:
Sample Stored Procedure to Send EDI Orders File via E-Mail
CREATE PROCEDURE spEDIGetReleasedOrdersEMail
AS
SELECT 4 AS EmailTypeID,
(SELECT 'kmangold@agrisoftcmc.com' AS EmailAddress FOR XML RAW, ROOT ('DataSet'), ELEMENTS) AS ToEmailAddress,
(SELECT 'Orders File' AS ReportTitle, 'Orders.xml' AS AttachmentFileName, 'XML' AS AttachmentFileType FOR XML RAW, ROOT ('DataSet'), ELEMENTS) AS MergeValue,
'someone@agrisoftcmc.com' AS BccEmailAddress,
'C:\Docs' AS AttachmentPath,
'Orders.xml' AS AttachmentFileName;
GO
Mapping Tables
The ImportExportMap table should have the following rows created for the parameters:
Column | Value |
---|---|
[idImportExportMap] | (Auto-Assign) |
[fkImportExportStep] | idImportExportStep from ImportExportStep |
[SourceField] | Name of field from Source Command |
[DestinationField] | emailTypeID |
[fkImportExportDestinationType] | 2 (for String) |
[InternalMethodArgumentOrder] | 1 |
Column | Value |
---|---|
[idImportExportMap] | (Auto-Assign) |
[fkImportExportStep] | idImportExportStep from ImportExportStep |
[SourceField] | Name of field from Source Command |
[DestinationField] | toEmailAddress |
[fkImportExportDestinationType] | 2 (for String) |
[InternalMethodArgumentOrder] | 2 |
Column | Value |
---|---|
[idImportExportMap] | (Auto-Assign) |
[fkImportExportStep] | idImportExportStep from ImportExportStep |
[SourceField] | Name of field from Source Command |
[DestinationField] | merge |
[fkImportExportDestinationType] | 2 (for String) |
[InternalMethodArgumentOrder] | 3 |
Column | Value |
---|---|
[idImportExportMap] | (Auto-Assign) |
[fkImportExportStep] | idImportExportStep from ImportExportStep |
[SourceField] | Name of field from Source Command |
[DestinationField] | bccEmailAddress |
[fkImportExportDestinationType] | 2 (for String) |
[InternalMethodArgumentOrder] | 4 |
Column | Value |
---|---|
[idImportExportMap] | (Auto-Assign) |
[fkImportExportStep] | idImportExportStep from ImportExportStep |
[SourceField] | Name of field from Source Command |
[DestinationField] | attachmentPath |
[fkImportExportDestinationType] | 2 (for String) |
[InternalMethodArgumentOrder] | 5 |
Column | Value |
---|---|
[idImportExportMap] | (Auto-Assign) |
[fkImportExportStep] | idImportExportStep from ImportExportStep |
[SourceField] | Name of field from Source Command |
[DestinationField] | attachmentFileName |
[fkImportExportDestinationType] | 2 (for String) |
[InternalMethodArgumentOrder] | 6 |