Christine_Chavez_6412

How to set SMTP_FROM_ADDR dynamically

Discussion created by Christine_Chavez_6412 on Mar 12, 2017
Latest reply on Mar 14, 2017 by Wolfgang_Brueckler_1288
SMTP_FROM_ADDR is set in UC_CLIENT_SETTINGS, and this is used in Notification or when you use SEND_MAIL.
The email sent will be from {value of 
SMTP_FROM_ADDR}.

The value for this is usually fixed (manually enter the value in UC_CLIENT_SETTINGS).

However, if for example you want the email sent to be from notify_{system}@abc.com, where {system} will be the name of the Automation Engine system..
eg:
in Production, system name is AE_PROD. So the email will be from notify_AE_PROD@abc.com
in Test, system name is AE_TEST. So the email will be from notify_AE_TEST@abc.com

If you set SMTP_FROM_ADDR to notify_&$SYSTEM#@abc.com in UC_CLIENT_SETTINGS, this will not work because &$SYSTEM# will be interpreted as plain text, and not as a (pre-defined) variable.

Use PUT_VAR instead.

:PUT_VAR UC_CLIENT_SETTINGS,"SMTP_FROM_ADDR","notify_&$SYSTEM#@abc.com " 
:SET &RES# = SEND_MAIL('whoever@email.com',,"Subject","No Text",,) 
:PRINT &RES# 

Outcomes