Configuring email

You're viewing Apigee Edge documentation.
Go to the Apigee X documentation.

By default, the Developer Services portal sends emails in response to certain events. For example, when a new developer registers on the portal, the portal automatically sends a welcome email to the developer. Or, if the developer loses their password, the developer can request an email with a temporary password.

As an API provider, you can control all aspects of the emails generated by the portal, including:

  • Formatting the automated emails sent by the portal
  • Specifying the SMTP server used by the portal
  • Adding rules to generate emails in response to events on the portal

Sending email from a cloud-based portal

The default email configuration for a cloud-based portal deployed on Pantheon or Acquia should only be used in non-production environments. Email sent from an anonymous cloud server may be blocked or marked as spam.

For production portals, use one of the following options for sending email:

Sending email from an on-premises portal

By default, mail is sent using the PHP mail() function. PHP tries to send email using sendmail on the local system, which can be configured in PHP's php.ini file.

For production portals, you can use the SMTP module described below to send email through an SMTP server or company server.

Configuring an SMTP server

The developer portal requires that you configure an SMTP server to send email messages. To configure the SMTP server, you must first enable the Drupal SMTP Authentication Support module on the developer portal.

After you configure the SMTP server, all emails sent by the developer portal use the SMTP server. These emails include emails sent to new developers, emails sent to developers who lose their password, and emails sent to developers with blocked accounts.

To configure the SMTP server:

  1. Log in to your portal as a user with admin or content creation privileges.
  2. Select Modules in the Drupal administration menu.
    The Modules page opens.
  3. Enable the SMTP Authentication Support module.
  4. Save the configuration.
  5. After the module is enabled, select Configure in the SMTP Authentication Support entry on the Modules page.
    The SMTP Authentication Support configuration page appears.
  6. Under Turn this module on or off, select On.
  7. In the SMTP server settings area, enter the following information:
    • SMTP server address. For example, for the Gmail outgoing SMTP server, use
    • Optionally enter the backup SMTP server address. This value is not required.
    • Enter the SMTP port. The value of this port can be different based on the selected encryption protocol. For example, for Gmail, the port is 465 when using SSL and 587 for TLS.
    • Select the encryption protocol as None, SSL, or TLS.
  8. In the SMTP Authentication area, specify the username and password used for SMTP authentication. This must be a valid username and password on the SMTP server.
  9. Under E-mail options, enter the email address and name of the user generating the email message. These values correspond to the "From" address of the email.
  10. Optionally, under Send test e-mail message, enter an email address where the portal sends a test message.
  11. Save the configuration.
    Saving the configuration generates the test email message and displays any configuration errors. Check the inbox of the email address of the test message to ensure that it arrives.
  12. Select Configuration > System > Site Information in the Drupal administration menu.
  13. Under Site Details, set the E-mail address to the same email address as you specified in Step 9.
    Some Drupal modules that generate emails use this field to determine the "From" address of the email, and not the value on the SMTP Authentication Support page.
  14. Save the configuration.

Configuring and formatting email notifications

You can configure various email notifications that are sent in response to particular activities such as registering, deleting, blocking, and unblocking developer accounts.

You can also control the "From" address of the emails.

To configure email notifications:

  1. Log in to your portal as a user with admin or content creation privileges.
  2. Select Configuration > People > Account settings in the Drupal administration menu. This opens the Account settings page.
  3. Select a type of email notification in the E-Mails section of the Accounts setting page. For example, you can select "Welcome (no approval required)", which sends an email when the developer account is automatically approved during the developer registration process.

  4. Edit the Subject and Body of the email notification.
    Place the cursor in a field, such as Subject, and then select the Browse available tokens link at the bottom of the form to see the list of tokens that you can use in the field. A popup appears that lets you select a token to add, such as [user:name], which corresponds to the user name of the developer.
  5. Click Save configuration.

You can also change the "From" name and address in an email notification.

To change the "From" name and address:

  1. Log in to your portal as a user with admin or content creation privileges.
  2. Select Configuration > System > SMTP Authentication Support in the Drupal administration menu. This opens the SMTP Authentication Support page.
  3. Specify a "From" email address in the E-Mail From Address field.
  4. Specify a "From" name in the E-Mail From Name field.
  5. Click Save configuration.
  6. Select Configuration > System > Site information in the Drupal administration menu.
  7. Specify the same email address that you used in Step 3 in the E-Mail Address field.
  8. Click Save configuration.

Generating an email when an event occurs

One common use of rules is to generate emails in response to an event. The portal has built in support for generating emails for predefined events, such as when a new developer registers an account. However, you can you can add your own rules to generate emails. For example, you can generate an email when the developer adds, removes, or modifies an app.

This section contains an example of how create a rule to generate an email when a developer registers an app. Modify this procedure as necessary to generate emails for other events.

To generate an email when a developer creates an app:

  1. Log in to your portal as a user with admin or content creation privileges.
  2. Select Modules in the Drupal administration menu.
  3. Ensure that the Rules UI module is enabled.
  4. Select Configuration > Workflow > Rules in the Drupal administration menu. This opens the Rules page.
  5. Select the Add a new rule button.
  6. On the new rules page, specify:
    • The rule name, for example "Send email rule".
    • Optionally specify any tags used to categorize the rules for search.
    • In the React on event dropdown, select Devconnect > Upon creation of a developer app.
  7. Save the rule.
    Saving the rule opens the Rules edit form with three panes: Events (which you just created), Conditions, and Actions.
  8. Under Actions, select Add action.
  9. From the Select the Action to Add dropdown, select System > send mail.
    This selection opens a page that lets you format the email. Use this form to specify the "To", "Subject", "Message", and other fields of the email.

    Expand the Replacement patterns link under each field to see the list of patterns that you can use in the field. For example, if you expand Replacement patterns under the To field, you will see a list of patterns that includes [app:developer]. If you specify this pattern in the To field, the email is sent to the creator of the app.
  10. Set the fields as shown below:
  11. Select Save to return to the rule editing page.
  12. Select Save changes.

Test the rule by adding a new app on the portal. You should receive an email notification in response that appears as below:

Subject: App test email app created

App: test email app
API products: PremiumWeatherAPI, weatherapikey-Product
Created at: Mon, 01/27/2014 - 10:16