swbrains

Well-Known Member
Sep 13, 2006
304
45
178
Hi,

Is there a way using the cPanel API to generate the same results from the UI's Track Delivery. Using this feature, you can enter an email address and it returns:
Event, Sender, Sent Time, Spam Score, Recipient, Result
Is there some way to do this via an API call? The only thing I could find was the Email Trace function which appears to be the older function in the UI that displays the mail server path a message sent to the specified address would take rather than a history of actual email messages sent to an address.

Thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463

swbrains

Well-Known Member
Sep 13, 2006
304
45
178
Hmmm... I'm not sure why this one is marked solved; maybe I marked it that way for some reason.

I did try this function "EmailTrack::search" as documented in the Email API module you linked to, but it doesn't allow me to specify a user account to filter by. It's results are similar to those provided by WHM, but without the ability to filter by user account. I'd like to offer my customers the ability to see which email deliveries have failed (incoming or outgoing) along with the reasons, but I don't want them to see mail sent/received outside their account. As the function stands (if I'm correct about the lack of filtering server-side), it's not practical to return all mail delivery records for the entire server and then filter them client-side in my script for one customer.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463
I'd like to offer my customers the ability to see which email deliveries have failed (incoming or outgoing) along with the reasons, but I don't want them to see mail sent/received outside their account. As the function stands (if I'm correct about the lack of filtering server-side), it's not practical to return all mail delivery records for the entire server and then filter them client-side in my script for one customer.
Hello,

The cPanel API 2 function will only output results for the account that's running the command. For example, a user logged in via SSH as "account1" can run the following command:

Code:
cpapi2 EmailTrack stats
This will only output information about queued email for that specific cPanel account.

Thank you.
 

swbrains

Well-Known Member
Sep 13, 2006
304
45
178
Thanks. I was able to all the function successfully under the logged account. However it returned no results, unlike the ones in cPanel UI->Track Delivery. Then I noticed the API docs say "This function displays tracking information for the messages in the account's message queue." The UI Track Delivery function seems to return email "history" (already sent/received messages) but perhaps this API call only returns what's currently in the queue (in progress)?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463
There's no UAPI or cPanel API 2 function that will provide the same functionality as the the "Track Delivery" option in cPanel. I encourage you to open a feature request if you'd like to see support for that added:

Submit A Feature Request

Thanks!
 

swbrains

Well-Known Member
Sep 13, 2006
304
45
178
I tried just now. It doesn't seem to show up in my Feature Requests after submitting. I probably tried 3 times so sorry if there is more than one copy. :(
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463
Requests are moderated by default, so once you make the submission it can sometimes take 24-48 hours before it's approved.

Thank you.