How To Guide

Controlling the From Address in an Email

Last Updated:
August 11, 2016


When you send an email with Esend, information is entered into the From address field based on data areas, user profile entries, or SMTP entries. Esend determines the information to use in the email’s From address based on the following hierarchy:

  1. Is there an entry for the job in a data area called ESNDADTA, in library QTEMP?
  2. If not, is there an entry for the user profile in the file ESNDADRP?
  3. If not, is there an SMTP entry for the user in WRKDIRE?
  4. If not, build the From address by concatenating the user profile@host name.domain name. (The host name and domain name are defined in option 12 of CFGTCP.)

You can control the information used in the From address of an email by changing the data in any of these entries, as described below.

Controlling the From Address in an E-mail

Choose one of the following options to control the From address(es) for different jobs. These options correspond to the hierarchy listed above.

Create a data area called ESNDADTA in the QTEMP library with the following atrributes:

  • Type = *CHAR
  • Length = 256
  • Include a value of the From address you want to use (for example,

Note: You can change the data area dynamically with a script or user program.

Using Esend From Address
Esend From addresses are stored in the ESNDADRP file. Using the ESNDADR command, you can create or edit the ESNDADRP address book file for your own user profile or any profile you have *CHANGE authority to. You can enter a name and e-mail address for each user profile.

Note: Use this option if you do not want to use the WRKDIRE entry SMTP function, or if you want to override its value.


Edit a user profile to associate it with an SMTP name in the IBM directory list. Select option 2 from the WRKDIRE edit screen to edit a user profile, and then press function key 19 to add or modify an e-mail address.

Note: There are two different formats for entering SMTP information for a user, depending on whether the CVTNAMSMTP command has been run. This command changes the structure of e-mail (SMTP) addresses associated with a WRKDIRE user entry, due to size limitations in the name.

  • Before running the CVTNAMSMTP command, enter the following SMTP information:
    SMTP user ID:     user_ID
    SMTP domain:   domain_name

where user_ID can be a maximum of 24 characters.

The SMTP name used for the address is user_ID@domain_name

  • After running the CVTNAMSMTP command, enter the SMTP information as:

  The SMTP name used for the address is SMTPAUSRID_SMTP@SMTPDMN_SMTP

If No Data Exists
If there is no ESNDADTA data area, no address book entry, and no WRKDIRE, Esend attempts to build an SMTP name from the user profile, the local host name from option 12 of the CFGTCP menu, and the local domain name from option 12 of the CFGTCP menu.

The SMTP name used for the address is user_profile@host_name.domain_name


You have a job that retrieves information and sends it via email to customers and vendors. In the customer emails, the From address is to be In the vendor emails, the From address is to be To fill in the appropriate From address, your job creates the data area ESNDADTA in the QTEMP library, and then changes the data area for each email depending on the recipient type—customer or vendor.

Note: For this type of scenario, the data area creation and address change should take place as the job runs, and not before the job is submitted.


Related Products