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:

  1. E-Mail Type ID
    Type type of E-Mail Template to use (Generally "4")
     

  2. To Email Address
    DataSet containing a list of E-Mail addresses.
     

  3. Merge Value
    DataSet containing values for each Merge Field.
     

  4. Bcc Email Address
    Semi-Colon separated listing of BCC E-Mail addresses.
     

  5. Attachment Path
    Directory of the Attachment
     

  6. 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

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

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

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

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

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

Column

Value

[idImportExportMap]

(Auto-Assign)

[fkImportExportStep]

idImportExportStep from ImportExportStep

[SourceField]

Name of field from Source Command

[DestinationField]

attachmentFileName

[fkImportExportDestinationType]

2 (for String)

[InternalMethodArgumentOrder]

6