hold_outgoing_email / release_outgoing_email

swbrains

Well-Known Member
Sep 13, 2006
265
37
178
Hi,

1) When you hold outgoing email, am I correct that email sent by that user is still queued but not delivered until you release outgoing email for that account?

2) Do these functions take an *email* account or an entire *cpanel* account? I'm assuming they affect all email for an entire cpanel account as the sender, but I wanted to be sure before I go further.

Thanks!
 

swbrains

Well-Known Member
Sep 13, 2006
265
37
178
The UAPI Email::hold_outgoing docs refers to a single email account but the WHM 1 API function hold_outgoing_email refers to a "cpanel account", which seems to imply the entire domain's mail would be held. Is UAPI Email::hold_outgoing not the same function as API 1 hold_outgoing_email?

I'm wanting to hold/queue outgoing email for an entire domain/cpanel account via the API until I issue a corresponding release command. Is this possible?

Thanks!
 
Last edited:

swbrains

Well-Known Member
Sep 13, 2006
265
37
178
Thanks. I was just confused by the UAPI functions of similar names since they appear to act differently. Normally, it seems that the UAPI functions are the new versions of the functions, so I was thinking that Email::hold_outgoing was intended to be the new UAPI version of the old hold_outgoing_email function. Since I need it hold for all mail sent out for an entire domain, I should stick with the WHM API 1 functions, correct?
 

swbrains

Well-Known Member
Sep 13, 2006
265
37
178
I have tried both WHM API1 hold_outgoing_email and suspend_outgoing_email from my Perl script running under a cpanel account with the user ID "testaccount" (example.com is the reseller account which is different than "testaccount" in the URL below if that matters):

$URI = "http://example.com:2086/json-api/suspend_outgoing_email?api.version=1&user=testaccount";

and the results are always "OK":

{"metadata":{"version":1,"reason":"OK","command":"suspend_outgoing_email","result":1}}

But the emails sent after calling hold or suspend are still immediately delivered. I never call the release/unsuspend functions in this script as a test to see if it will actually hold/stop the outgoing messages.

My Perl script uses MIME::Lite to construct and send the message via sendmail (I also tried having MIME::Lite send via SMTP with the same results).

Any ideas why it would respond that the hold/suspend operation was successful, but still deliver the messages immediately?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
But the emails sent after calling hold or suspend are still immediately delivered. I never call the release/unsuspend functions in this script as a test to see if it will actually hold/stop the outgoing messages.

My Perl script uses MIME::Lite to construct and send the message via sendmail (I also tried having MIME::Lite send via SMTP with the same results).

Any ideas why it would respond that the hold/suspend operation was successful, but still deliver the messages immediately?
Hello @swbrains,

1. Can you confirm which cPanel & WHM version you are reproducing this behavior on?
2. Do you have a copy of the Perl script you are using so we can attempt to reproduce this on a test system?
3. Can you confirm that outgoing emails are suspended/held when attempting to send a message using traditional methods (e.g. via Webmail or an email client)?
4. Can you let us know the output to /var/log/exim_mainlog when reproducing the behavior in your custom script?
5. Are you sending an email to a remote server, or are you testing by sending an email to a local user hosted on the cPanel server?

Thank you.
 

swbrains

Well-Known Member
Sep 13, 2006
265
37
178
Hi,

1. Can you confirm which cPanel & WHM version you are reproducing this behavior on?
WHM = 76.0.17
In cPanel for this account, it says the same cPanel version -- not sure where else to look for this.

2. Do you have a copy of the Perl script you are using so we can attempt to reproduce this on a test system?
Unfortunately, it's a proprietary script for my business and can't be shared. It would also take many dependencies to set it up in another environment. :(

3. Can you confirm that outgoing emails are suspended/held when attempting to send a message using traditional methods (e.g. via Webmail or an email client)?
I have not tried this yet. Should it work for email sent via script/sendmail as opposed to webmail/email client?

4. Can you let us know the output to /var/log/exim_mainlog when reproducing the behavior in your custom script?
Ok, I'll have to reproduce this and pull that info the next time I test it.

5. Are you sending an email to a remote server, or are you testing by sending an email to a local user hosted on the cPanel server?
The emails were sent to addresses at different domains hosted on the same server.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
The emails were sent to addresses at different domains hosted on the same server.
Hello @swbrains,

The suspend_outgoing_email and hold_outgoing_email WHM API 1 functions apply when a user sends an email to an email address hosted on a remote mail server. Email deliveries to local addresses will continue to work.

Thank you.
 

swbrains

Well-Known Member
Sep 13, 2006
265
37
178
I was able to confirm (hold/suspend) is working for outgoing email to remote servers.

Is there a way to disable the email notification back to the sending address that the message wasn't delivered: "Domain example.com has an outgoing mail hold. Message will be reattempted later"

Basically, I would like to be able to queue messages during a long process without actually having the server attempt delivering them. At some point after the long process ends, I would like to be able to release the hold and allow delivery to begin again. I'm just trying to delay delivery for a couple of minutes in this case to allow an intensive process to end first before delivery starts. But I'd like all of this to occur without the user being notified of the delay for every outgoing message. Is such an outcome possible?

Thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
Basically, I would like to be able to queue messages during a long process without actually having the server attempt delivering them. At some point after the long process ends, I would like to be able to release the hold and allow delivery to begin again. I'm just trying to delay delivery for a couple of minutes in this case to allow an intensive process to end first before delivery starts. But I'd like all of this to occur without the user being notified of the delay for every outgoing message. Is such an outcome possible?
Hello @swbrains,

You could open a feature request for the inclusion of a new functionality that facilitates the ability to decide whether the "Domain example.com has an outgoing mail hold. Message will be reattempted later" notification is enabled or disabled.

However, you may want to consider adjusting the queue_only_load Exim configuration setting using WHM >> Exim Configuration Manager >> Advanced Editor if your intent is to hold the Exim queue at times of higher server loads. Here's a description of this setting:

If the system load average is higher than this value, incoming messages from all sources are queued, and no automatic deliveries are started. If this happens during local or remote SMTP input, all subsequent messages received on the same SMTP connection are queued by default, whatever happens to the load in the meantime, but this can be changed by setting queue_only_load_latch false.

Deliveries will subsequently be performed by queue runner processes. This option has no effect on ancient operating systems on which Exim cannot determine the load average. See also deliver_queue_load_max and smtp_load_reserve.
Thank you.
 

swbrains

Well-Known Member
Sep 13, 2006
265
37
178
Thanks. I have actually adjusted that setting in Exim to queue mail only until the load drops. I was just hoping to be able to have more granular control for a particular account when I know that account will be running an intensive script that will queue a lot of messages.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,250
463
Thanks. I have actually adjusted that setting in Exim to queue mail only until the load drops. I was just hoping to be able to have more granular control for a particular account when I know that account will be running an intensive script that will queue a lot of messages.
A feature request is the way to go if you'd like to see support for that level of granularity. Feel free to post the link to the request here once it's opened.

Thank you.