Store Recipient Attributes
You can use variations of the following optional MIME header to store additional recipient attributes:
X-Clab-SmartRelay-Recipient-
- Followed by the relevant column field name in the user database and the appropriate value
Use
You need to add one header for each of the attributes that you want to store in the database.
Format
Each header must conform with the following rules:
- Every header must start with
X-Clab-SmartRelay-Recipient-
- The next part must match the name of the relevant column field name in the database, written in CamelCase
For example,Name
. - The next entry must be the appropriate value
The length of the value must not be more than the maximum allowed for the relevant field in the database.
See the User database field types and formats table below for more details.
As a result, the value of X-Clab-SmartRelay-Recipient-Name
, for example, is mapped to the appropriate field in the name column of the user database, while X-Clab-SmartRelay-Recipient-RequestType
is mapped to the request_type column.
User database field types and formats
The following table shows the valid user database field types and formats that you must apply when using the additional recipient attributes header.
Field Type | Field Format | Correct Example | Incorrect Example |
---|---|---|---|
CHAR, VARCHAR, TEXT | A string | Hello! | Do not use any control character, for example, ^C or ^Y |
INT | An integer string | 351657 | 54tmni9 |
Date | yyyy-MM-dd | 2013-10-01 | 20131001 |
Datetime | yyyy-MM-dd hh:mm:ss | 2013-10-01 14:11:57 | 2013/10/01-14.11.57 |
Boolean | ‘1’, ‘0’,’true’, ‘false’ | 1 | 98as7idcda |
The appropriate value cannot exceed the maximum length of the relevant database field.
Example:
Session session = Session.getInstance( System.getProperties(), null );
Message msg = new MimeMessage( session );
msg.setHeader( “X-Clab-SmartRelay-Recipient-FirstName”, “James” );
msg.setHeader( “X-Clab-SmartRelay-Recipient-LastName”, “Person” );
msg.setHeader( “X-Clab-SmartRelay-Recipient-Age”, “21” );
msg.setHeader( “X-Clab-SmartRelay-Recipient-Birthdate”, “1994-10-01” );
See the Web UI online manual for more about user databases, field types and similar.
Error conditions
SmartRelay terminates the message process and returns a BOUNCE error if one of the following happens:
- The destination field does not exist in the user database
- The field type or format of the value does not match that of the relevant field in the database
- The length of the value is greater than the maximum allowed for the relevant field in the database
If a BOUNCE error occurs, the original message is saved and scheduled for automatic reprocessing by SmartRelay. Time is allowed for the error to be corrected between delivery attempts. However, the message is failed permanently after a certain length of time, usually 36 hours.