Oracle Cloud Infrastructure Documentation

Integrating Postfix with Email Delivery

Configure Postfix to Send Email Through Email Delivery

You can use Postfix to send emails through Email Delivery. Before you use Postfix you must configure Oracle Cloud Infrastructure Email Delivery in your Postfix application.

Note

The paths and commands used below for specifying file locations are specific to Ubuntu/Debian; your file paths or editing commands may differ depending on the operating system you are using. The changes to the configuration files are the same.

To enable Postfix to integrate with Email Delivery:

  1. Make sure Email Delivery is configured to send email. See Getting Started with Email Delivery.

Note

The SMTP credentials are required to configure Postfix to use Email Delivery. Be sure to note the user name and password when you generate the SMTP credentials.

  1. Update the Postfix main.cf file.

    To open the main.cf file, run the following command:

    sudo vi /etc/postfix/main.cf

    Add the following information to the end of the file:

    smtp_tls_security_level = may 
    smtp_sasl_auth_enable = yes 
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd 
    smtp_sasl_security_options =
  2. If the following line is present, either remove the line or turn it off:

    smtpd_use_tls = yes
  3. Update relayhost to include your SMTP connection endpoint and port. For example:
  4. relayhost = smtp.us-ashburn-1.oraclecloud.com:587		

  5. Create the sasl_passwd file in the same directory as main.cf.

    Run the following command:

    sudo vi /etc/postfix/sasl_passwd
  6. Add your relay host and port by entering:

    server:port user:pass

    where:

    • server is your relay host and port is 25 or 587.
    • user is the user name and pass is the password you received when you generated your SMTP credentials.
  7. Enter the permissions in the password file.

    Run the following command:

    sudo chown root:root /etc/postfix/sasl_passwd && sudo chmod 600 /etc/postfix/sasl_passwd
  8. Generate the password hash.

    Run the following command:

    sudo postmap hash:/etc/postfix/sasl_passwd
  9. Reload Postfix.

    Run the following command:

    sudo postfix reload
  10. Test the configuration by sending a test email.

    Run the following command:

    echo "This is a test message" | mail -s "Test" <recipient email address> -f "<approved sender email address>"

    If you want to monitor the log while you send the test email, open a separate Terminal window and run the following command before running the test command:

    log stream --predicate '(process == "smtpd") || (process == "smtp")' --info

    A status=sent (250 Ok) message in the log indicates the email was sent successfully.

Note

If you are using SASL authentication, you must use the following RPM package: cyrus-sasl-plain. See PostFix for further documentation on configuring SASL authentication.

More Information

See the Postfix website for more information on Postfix configuration.