Child pages
  • UAPI Functions - Email::add_auto_responder
Skip to end of metadata
Go to start of metadata

Description

This function creates an autoresponder for an email account.

Important:

In cPanel & WHM version 76 and later, when you disable the MailReceive and MailSend roles, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Email/add_auto_responder?email=user&from=User%20Name&subject=Autoresponder%20Subject&body=This%20is%20an%20autoresponder%20message.&domain=example.com&is_html=1&interval=24&start=1410277881&stop=1410300000


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Create an autoresponder for user@example.com
$add_auto_responder = $cpanel->uapi(
    'Email', 'add_auto_responder',
    array(
        'email'         => 'user',
        'from'          => 'User Name',
        'subject'       => 'Autoresponder Subject',
        'body'          => 'This is an autoresponder message.',
        'domain'        => 'example.com',
        'is_html'       => '1',
        'interval'      => '24',
        'start'         => '1410277881',
        'stop'          => '1410300000',
         )
);


Note:

For more information, read our Guide to the LiveAPI System.

 

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Create an autoresponder for user@example.com
my $add_auto_responder = $cpliveapi->uapi(
    'Email', 'add_auto_responder',
    {
        'email'         => 'user',
        'from'          => 'User Name',
        'subject'       => 'Autoresponder Subject',
        'body'          => 'This is an autoresponder message.',
        'domain'        => 'example.com',
        'is_html'       => '1',
        'interval'      => '24',
        'start'         => '1410277881',
        'stop'          => '1410300000',
    }
);


Note:

For more information, read our Guide to the LiveAPI System.

 

 cPanel Template Toolkit
<!-- Create an autoresponder for user@example.com -->
[% data = execute( 'Email', 'add_auto_responder', { 'email' => 'user', 'from' => 'User Name', 'subject' => 'Autoresponder Subject', 'body'          => 'This is an autoresponder message.', 'domain' => 'example.com', 'is_html' => '1', 'interval' => '24', 'start' => '1410277881', 'stop' => '1410300000' } ); %]


Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username Email add_auto_responder email=user from="User Name" subject="Autoresponder Subject" body="This is an autoresponder message." domain=example.com is_html=1 interval=24 start=1410277881 stop=1410300000


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
     
  },
  "data": null
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
emailstring

Required

The email account name.

A valid email account name on the server.

For example, user if the email address is user@example.com.

user
fromstring

Required

The contents of the autoresponder message's From: field.

Any string, or a blank value.

User Name
subjectstring

Required

The contents of the autoresponder message's Subject: field.

Any string, or a blank value.Autoresponder Subject
bodystring

Required

The contents of the autoresponder message's Body section.

Any string, or a blank value.This is an autoresponder message.
domainstring

Required

The email account's domain.

The email account's domain.

For example, example.com if the email address is user@example.com.

example.com
is_htmlBoolean

Required

Whether the body of the autoresponder message begins with an HTML Content-Type declaration.

  • 1 — Include an HTML content type declaration.
  • 0 — Do not include an HTML content type declaration.
1
charsetstring

The character set.

This parameter defaults to us-ascii.

Any standard character encoding set.

UTF-8
intervalinteger

Required

The amount of time, in hours, that the server waits between autoresponder messages to the same address.

Any positive integer.

Note:

If you specify 0, the system sends a message for each received email. 

24
startinteger

Required

When to enable the autoresponder in Unix time .

A time, in Unix time format.1410277881
stopinteger

Required

When to disable the autoresponder in Unix time.

A time that is after the start time, in Unix time format.1410300000

Returns

This function only returns metadata.