ANVEDI SMTP
This communication code unit allows to send files using the SMTP protocol via the File Exchange Service.
To use this service, you need Anvaigo EDI Connect version 5.3.0.7, and the File Exchange Service must be properly configured and accessible.
Configuration
To configure the communication channel, find it in the EDI Communication Channel List and click on “Configure”. If you’ve just created the channel you might need to refresh the page first.
General
Select or create a new File Exchange Service instance. You have to configure the URL (can be copied from the configuration and is shown on startup if you start the service directly). The default value is http://localhost:7098 and you have to set the API Key corresponding to the configuration file. You can use the server for multiple communication partners.
The subject of the mail. You can use placeholders in this field.
If no other method is used in the mappings to set the recepient email address, the value from this field will be used.
The other method to set the recipient email address is to use the function SET_RECEIVER_IDENTIFICATION from the function object COMMUNICATION in a mapping that is processed before the export mapping.
If this option is set, the file will be sent as attachment to the email. If not it will be sent in the body. The default value is .
A template string to build the file name for outgoing files. You can use any constant text that is valid inside file names. We support several global variables that can be used inside the filename. Because the module does not know the content of the file and the used buffer structures you cannot directly access data from the file.
You can use placeholders in this field.
Server
Specifies the address of the SMTP server.
Specifies the port of the SMTP server.
Specifies the encryption method to be used. The available options are:
The encryption is automatically negotiated between the File Exchange Service and the remote host. This is the default setting.
No encryption is used.
An encrypted connection is established.
An unencrypted connection is started and the server is asked to continue the communication with encryption.
Specifies how to authenticate at the remote host. The available options are:
Anonymous login is used.
A combination of Username ans Password is used. This is the default setting.
Uses the Exchange OAuth2 method for authentification. See below for more details.
Specifies the username for the login on the SMTP server.
Specifies the password for the login on the SMTP server.
When the connection is encrypted, this option lets you ignore any errors that arise from certificates.
OAuth2
In case you want to use OAuth2 with Exchange 365 you will need to create a new “App registrations” in the Azure portal.
Got to the Azure Portal, search for “App registration” and create a new one. Call it, for example, Anvaigo File Exchange Service. You can leave all the other settings on the default values and click on “Register”. (You can learn more about App regsitrations here: https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app)
Afterwards take a note of the “Application (client) ID” and “Directory (tenant) ID” you’ll need to put these values into the configuration settings of the communication channel.
There is one setting that has to be changed for the new app registrations: Select “Authentication” in the left pane and search for “Allow public client flows”. This has to be enabled to allow the login via the Device ID.
In Dynamics, make sure to select “Exchange OAuth2” as the authorization method. Select “DeviceCode” as the OAuth Method and enter the Tenant ID and Client ID from the portal (this might be different from the Dynamics Tenant ID!).
To login, click on “Authenticate” in the POP3 settings page. You’ll get a URL and DeviceID, which allows you to sign in. Anencrypted token is stored on the File Exchange Server and can be used to get the emails, until the token lifetime has expired. In this case fetching the messages will fail and you have to log in again.
