How Can We Help?
If you do not want to use Outlook or MAPI for the document delivery or scheduled task emails that GP Agent sends, you can use SMTP based email to handle all email from either the DPS or from the Dynamics GP client workstation. You may want to do this if your organization uses web-based email or does not use Exchange Server.
In order to implement SMTP email for GP Agent, we have build a .NET assembly that is installed in SQL Server. In order to send any attachments created by GP Agent tasks, the assebly requires external access (i.e. access to the operating system), so changes must be made to your SQL Server databases in the form of SQL statements. By default, these statements are automatically executed as part of the GP Agent Setup Wizard, so there’s no additional work for you to do, but you should be aware of the changes, in case you have IT considerations. In order for the setup wizard to complete the installation of the .NET assembly, DYNSA must be the dbowner of your Dynamics GP databases (so make sure that this has not been altered by a restore or database attach script).
When using SMTP, the assembly executes within the context of SQL Server, not the Windows Server operating system. This impacts the ability of the assembly to access any attachments that GP Agent wants to include in the emails. SQL Server usually runs as a local system account and therefore has access to the local hard drive but has no access to mapped network drives or network shares. If you will be submitting GP Agent tasks to a DPS on a machine other than the one you’re logged into, we recommend making the destnation folder for the attachments a folder on the DPS (one that you can share, if necessary). This is usually an easier configuration than trying to run SQL Server as a domain account.
SQL statements needed to enable SMTP email for GP Agent:
– ALTER DATABASE [your GP database] SET TRUSTWORTHY ON
– sp_configure ‘clr enabled’, 1
– reconfigure
– grant execute access assembly to DYNSA — this is run only in the context of the master database
If you do not want any of these changes made, add the following line to your global Dex.ini file before running the GP Agent Setup Wizard:
GPAgentSetupSMTP=FALSE
If you want to enable SMTP but do not want to alter the database TRUSTWORTHY setting, you must manually load the assembly:
– Follow the Creating an Assembly instructions to install the mc2software.Email.dll into all (system and company) Dynamics GP databses with an asymmetric key.
– Add the following line to your global Dex.ini file before running the GP Agent Setup Wizard:
GPAgentSetupSMTP=MANUAL
In order to use SMTP email, you must install GP Agent on your SQL Server machine or SQL Server will not be able to locate the DLL used by GP Agent.
If you are including attachments in your emails, those attachments must be accessible by SQL Server. We recommend that you setup a network share for the location of your report file attachments. A UNC path must be used when you assign the destination of your task reports. You should also assign a default archive location the same way, so that reports that might not otherwise be specified by your task have a place to be saved. SQL Server typically runs as a Network Service, so if that’s your configuration, you must assign the SQL Server Computer Read access to the folder location.
If you enable SMTP email, it is recommended that you assign a BCC email address on the GP Agent SMTP Setup window (accessible from the GP Agent User Options window), as SMTP does not automatically add messages to your Sent Items folder.
Note: The manual method has not been specifically tested, but the Setup Wizard has been designed to alter the database directly and install the SQL functions and procedures only if the assmbly exists in the databases. As long as the assembly exists, the GP Agent Setup Wizard will load the necessary SQL function and stored procedure needed to send emails.
If you use a port other than 25 for your SMTP server, you will need to add the following line to your global dex.ini file, where “##” is the port number:
mc² SMTP Port=##