Default Address

For cPanel version 11.40

(Home >> Mail >> Default Address)

Overview

This feature allows you to set up a default address that receives any mail sent to an invalid email address for the domain. The default address is also commonly called a “catch-all address.” You can also define how the default address handles incoming messages.

Set Up a Default Address

To set up your default address:

  1. Select the domain for which you wish to set up a default address.
  2. Select one of the following options:
    • Discard with error to sender
      • Sends an error message to the sender when an email is sent to this address.
      • After you select this option, enter an error message that will be emailed to the sender.
    • Forward to email address
      • Enter the address to which to forward emails in the text box.
      • You do not need to type “@” and the domain name.
    • Select Advanced Options for the following options:
      • Forward to your system account
        • Allows you to forward incoming messages to the system account.
          • note Note: To check the default email account for your cPanel account, click the appropriate Access Webmail link in the Default Email Account box in the Email Accounts interface (Home >> Mail >> Email Accounts).
      • Pipe to a Program
        • Automatically forwards messages to a program at the path that you define in the Pipe to a Program text box.
          • For example, /home/$utility
        • For more information about this option, see the documentation below.
      • Discard
        • Deletes incoming messages without an automatic response.
        • note Note: This option is not recommended since the sender will be unaware that the delivery failed.
  3. Click the Change button.

note Note: If spammers target your domain, and you forward mail to a default address, that address is likely to receive a large amount of spam.

Pipe to a Program

This option routes mail to any executable script within the cPanel user's home directory. This includes executable scripts such as bash scripts, Perl scripts, and PHP scripts.

  • The Pipe to a Program feature in cPanel is not typically used to filter email. Instead, it is often used to parse and enter email information into a different system.
    • For example, the Pipe to a Program feature can allow you to pipe the email information to a program that enters email information into a ticket system.
  • The email and headers are piped to the program via STDIN
  • Memory limit issues depend on the language or environment that you use.
  • Any output, even a blank line, that is created by the script, will create a bounce message that contains that output.
  • Make sure that your script uses the proper file permissions (rwxr-xr-x). To change your script's file permissions, run:
    • chmod 755 myscript.php where myscript.php is meant to stand for your script's location and file name.
  • Your script must contain the correct hash bang:
    • #!/usr/bin/php -q — For PHP.
    • #!/usr/bin/perl — For Perl.
  • Pipes can accept variables from the $_SERVER array.
  • Pipes can accept variables on the command line.

Topic revision: r20 - 27 Dec 2013 - 19:04:54 - Main.SarahHaney