Show pageOld revisionsBacklinksExport to PDFBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. {{tag>Index Email Outgoing Process Intelligent_Business_Object}} [<10>] ====== Sending Outgoing E-mails ====== To be able to send e-mails in **AwareIM** you need to do the following: - Define "transport" for sending e-mails - Define a notification representing the e-mail you want to send - Define a ''[[a_f:a:send|SEND]]'' action of the Rule Language to send the e-mail to either an intelligent business object or a particular email address ===== Defining Email Transport ===== First of all, you need to define whether you will be using a standard SMTP-based email transport or Microsoft Graph REST-ful service. ==== Defining SMTP Transport ==== When defining SMTP transport you can specify global SMTP settings that will be used to send any email in your application. To define such settings double click on the business space version and select the "Outgoing Emails" property. The "Outgoing Emails" dialog will be displayed. Here you can specify whether SMTP settings will be stored in the special attributes of the SystemSettings object(these attributes are always available) or whether they will be specified directly in the Configuration Tool. The former is useful when these values can change. For both options the set of values to specify is the same and includes the following: <callout type="primary" icon="true"> Note: You need to pick a particular email provider like gmail, hotmail etc and find out actual SMTP values that these providers require </callout> === Outgoing Email Host === The DNS name of the SMTP server that will send e-mails.\\ \\ === Outgoing E-mail Port === The port that the SMTP server is listening on for e-mail requests.\\ \\ === "From" address === The e-mail address that your e-mails will have as the “from” address. Note that the "from address" must be recognized by your email server, so it must be registered on this server.\\ \\ === Login details === If your outgoing e-mail provider requires that you log in using standard user name and password combination, fill in "User Name" and "Password" fields.\\ \\ === OAuth Support === Some email providers require OAuth authentication, in which case you have to provide details by ticking the "OAuth support" checkbox. When using the SystemSettings object, tick the "Add attributes for OAuth support to the SyetemSettings object. This will add OAuth-specific attributes to this object. Defining OAuth settings is very similar to providing OAuth settings for REST communication see [[docs:2500_config_apps/0500_add_edit_objects/0600_intelligent_bo/0400_setting_rest_channel_props]] \\ === SSL Support === Whether the SMTP server supports the SSL protocol.\\ \\ === TLS Support === Whether the SMTP server supports the TLS protocol.\\ ==== Using Different SMTP Accounts When Sending E-mails ==== Sometimes it may be necessary to use different SMTP settings for different users. This can be achieved by defining a special business object that represents an SMTP acount. You will need to do the following:\\ \\ - Create a definition of the e-mail account object in the Configuration Tool by selecting the Business Objects node in the tree and then choosing "Add Outgoing Email Account" menu command. This command will create the object with the predefined attributes that cover all SMTP settings described above. - Define the ''[[a_f:a:send|SEND]]'' action with the ''USING'' syntax. When using this syntax The instance of the ''OutgoingEmailAccount'' object will be taken from the Context of the rule(exactly one instance of this object must be present in the Context) and the values in this instance will be used to send the actual e-mail. - At runtime this instance of the ''OutgoingEmailAccount'' object needs to be created before invoking a process that uses this account in the ''SEND'' action. ==== Sending Emails Using Microsoft Graph ==== Using Microsoft Graph for sending emails does not mean that you have to replace SEND actions with REST service calls. The framework for email handling remains the same - whether you use SMPT or MS Graph. To send emails using Microsoft Graph you need to obtain your client id and secret from Microsoft, as well as tenant id and sender info. For details go to [[https://learn.microsoft.com/en-us/graph/api/user-sendmail]]. You then need to tick the "Emails will be sent using Microsoft Graph checkbox and click on the Settings link next to the checkbox. Then you need to enter values obtained from Microsoft. ==== E-mail Notification ==== The actual e-mail sent to an external party must be a notification – see [[docs:2500_config_apps:1200_add_edit_notifications|Adding/Editing Notifications]]. It is up to you how you define the attributes of this notification and the rules that will be executed when this notification is created. However, you have to make sure that you define the following attributes in the notification representing an outgoing e-mail: - ''Subject'' – this attribute must be of the Plain Text type and must contain the subject of the e-mail. - ''Message'' – this attribute must be of the Plain Text type and must contain the body of the e-mail. - ''HTMLMessage'' – this attribute must be of the Document type. If value of this attribute is defined and contains valid HTML document, the email will be sent in HTML format rather than in a standard text format. - ''CC'' and ''BCC'' - these attributes represent copy and blind copy lists respectively. The email addresses in the list must be separated by a semi-colon. You can initialize the list from a list of references by using the ''[[a_f:f:af:list_line|LIST_LINE]]'' function. You can also optionally add the EHeaders attribute to this notification if you want to add special headers to your email. The value of this attribute should be in the following format: <code>Header1#Header2#Header3... </code> where each header represents name and value in the standard header format: <code>Name: value </code> The Configuration Tool provides a convenience feature that creates the skeleton of the outgoing e-mail notification with all the required attributes automatically. You can use this feature to add the notification and then change it as you wish. To create the outgoing e-mail notification: - Right click on the "Notifications" node of the business space version in the Elements Tree to bring up the pop-up menu. - Select the "Add Outgoing E-mail Notification" command from the pop-up menu. The new notification with the name OutgoingEmail will appear in the Elements Tree. Using the steps described above you can add as many outgoing e-mail notifications as you like. You can then change their names, add other attributes and/or attach creation rules – see [[docs:2500_config_apps:0800_add_edit_rules|Adding/Editing Rules]]. <callout type="primary" icon="true"> Note that if you want to send an e-mail with attachments, you can define an attribute of the Document type in the e-mail notification. At run time you should populate this attribute with some document, **AwareIM will automatically use this document as an e-mail attachment. </callout> ==== SEND Action ==== This action of the Rule Language sends the notification to either an intelligent business object or to a specified e-mail address, optionally using a particular e-mail account SMTP settings. Here are some examples: <code>SEND SignupEmail TO Customer</code> This action will create an instance of the SignupEmail notification and send it to a Customer(s) in Context using global SMTP settings. The Customer object must have Email Communication channel defined. If there are multiple instances of the Customer object in Context, the e-mail will be sent to all of them. <code>CREATE SignupEMail WITH SignupEmail.BCC = 'test@test.com' SEND SignupEmail USING OutgoingEmailAccount</code> This action will send an e-mail to test@test.com using an e-mail account in Context index email outgoing process intelligent business object Log In