We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Child pages
  • UAPI Functions - BoxTrapper::save_email_template

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function saves the contents of a BoxTrapper message template.

Multiexcerpt include
SpaceWithExcerptLIB
MultiExcerptNameAPIDisabledReceiveMailRoleNonVersion
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples 


Panel
bgColor#FFFFFF
borderStylenone


Expand
titlecPanel or Webmail Session URL


Code Block
languagetext
https://hostname.example.com:2083/cpsess##########/execute/BoxTrapper/save_email_template?email=user@example.com&template=blacklist&contents=To%3A+%25email%25%0D%0ASubject%3A+Re%3A+%25subject%25%0D%0AThe+user+%25acct%25+does+not+accept+mail+from+your+address%0D%0A%0D%0AThe+headers+of+the+message+sent+from+your+address+are+shown+below%0D%0A%0D%0A%25headers%25%0D%0A

Include Page
LIB:_CallUAPIFromBrowserLink
LIB:_CallUAPIFromBrowserLink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.

// Save BoxTrapper message template content for user@example.com.
$save_email_template = $cpanel->uapi(
    'BoxTrapper', 'save_email_template',
    array(
        'email'    => 'user@example.com',
        'template' => 'blacklist',
		'contents' => 'To: %email%\nSubject: Re: %subject%\n\nThe user %acct% does not accept mail from your address.\n\nThe headers of the message sent from your address are shown below:\n\n%headers%\n',
    )
);

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Save BoxTrapper message template content for user@example.com.
my $save_email_template = $cpliveapi->uapi(
    'BoxTrapper', 'save_email_template',
    {
        'email'    => 'user@example.com',
        'template' => 'blacklist',
		'contents' => 'To: %email%\nSubject: Re: %subject%\n\nThe user %acct% does not accept mail from your address.\n\nThe headers of the message sent from your address are shown below:\n\n%headers%\n',
    }
);

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink


Expand
titlecPanel Template Toolkit


Code Block
languagexml
linenumberstrue
<!-- Save BoxTrapper message template content for user@example.com. -->
    SET result = execute('BoxTrapper', 'save_email_template', {
        email => 'email@domain.com',
        template => 'blacklist',
        content => "To: %email%\nSubject: Re: %subject%\n\nThe user %acct% does not accept mail from your address.\n\nThe headers of the message sent from your address are shown below:\n\n%headers%\n"
    });

	IF result.status; %]

        <h1>Success!</h1>
        ...
    [% ELSE %]
        [% FOREACH error in result.errors %]
            <p>[% error %]</p>
        [% END %]
    [% END %] 

Include Page
LIB:_TTLink
LIB:_TTLink


Expand
titleCommand Line


Code Block
languagebash
uapi --user=user BoxTrapper save_email_template email=user@example.com template=blacklist contents=To%3A+%25email%25%0D%0ASubject%3A+Re%3A+%25subject%25%0D%0AThe+user+%25acct%25+does+not+accept+mail+from+your+address%0D%0A%0D%0AThe+headers+of+the+message+sent+from+your+address+are+shown+below%0D%0A%0D%0A%25headers%25%0D%0A

Include Page
LIB:_UAPICLINote
LIB:_UAPICLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
    "data": null,
    "errors": null,
    "messages": null,
    "metadata": {},
    "status": 1
}


Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
email

string

Required

The account's email address.

Warning
titleWarning:

If you call this function in Webmail, the system overrides this parameter. This parameter defaults to the current email address.


A valid email address on the cPanel account.user@example.com
templatestring

Required

The message template.

  • blacklist
  • returnverify
  • verifyreleased
  • verify
Warning
titleImportant:

If you use the verify template, you must include Subject: verify#%msgid% in this parameter's value.


Note
titleNote:
  • For more information about each template, read our BoxTrapper


blacklist
contents string

Required

The template file's contents.


A valid, URI-encoded string.

Warning
titleImportant:
  • You must include To: %email% in this parameter's value.
  • If you use the verify template, you must include Subject: verify#%msgid% in this parameter's value.
  • This value cannot exceed four kilobytes (KB).



Expand
titleClick to view...


Code Block
To: %email%\nSubject: Re: %subject%\n\nThe user %acct% does not accept mail from your address.\n\nThe headers of the message sent from your address are shown below:\n\n%headers%\n



Returns

This function only returns metadata.