Skip to main content
We are aware of an issue after updating to cPanel versions 11.110.0.65, 11.126.0.21, or 11.128.0.11, some cPanel plugins or features are no longer functioning properly including WP Toolkit. Please see the following article for more information and updates:
Update to latest cPanel 110, 126, or 128 versions removes "addonfeatures" directory.

Create forwarder on non-existing email address

Comments

8 comments

  • cPanelMichael
    We noted that on new release of cPanel, it is no more possible to create a forwarder on an email address that doesn't exist on the system. This was possible before, but I don't remember exactly when (11.46, 11.48.2... ?).

    Hello, This is by design, as it should produce the following error message: (Warning: "user@domain" does not refer to a valid local email account or alias. The system will not create a forwarder, because it already sends that email to the default address.)
    It's not possible to disable this functionality, but you could setup a hook that automatically creates the local email account before creating the forwarder. Thank you.
    0
  • tizoo
    Hi cPanelMichael, Thank you for your response. I also thought about your solution, that is to say creating the email address in a pre hook and deleting it on a post hook. But as this seemed to me a little bit *killing a fly with a shotgun* I was wondering if there was not a more simple solution. Regarding your response it seems that it's not the case. Thanks for this information that let us go forward. Cheers, Philippe
    0
  • cPanelMichael
    Hello, One other solution is to insert filter rules for the account that redirect email if the recipient matches a specific address. Thank you.
    0
  • tizoo
    Hi cPanelMchael, The solution using filter rules is not an option as it change the customer approach. Our plugin let customers to define business level mailboxes on a Zimbra server through their cPanel interface. They could also define classic mailboxes directly on the cPanel server. As the idea is to managed everything from cPanel interface, when they define a forwarder on a mailbox defined on the Zimbra server, the behavior should be the same as if the mailbox was a classic one defined on the cPanel server. We will use the approach of create mailbox, create forwarder, delete mailbox which seems the only one that should work. Thanks for your support and idea. Cheers, Philippe
    0
  • shoutandecho
    Why is this by design? I'm having lots of problems with the new cPanel version, and this is another one. I have domains assigned to my system for which i just host websites (another company points their A records to my IP address). Before this new cPanel release, if i wanted to forward email from my server to an email account on one of the domains assigned to my server, i could so without problems. Everyone was happy. Now i get the error mentioned above. Example: i am hosting a site for domain1.com. They are pointing their A record to my IP. No email hosted by me, and their MX records are pointed to a separate mail server. Before, i could forward email from my server to emailaddress@domain1.com. Now i get the error.
    0
  • tizoo
    Hi cPanelMichael, I tried to make it work (create the email in the pre hook and delete it in the post hook) but I'm stuck on understanding how everything works. I know that the hook is executed as the user creating the forwarder, then thus the user is logged (it execute the hook) how could I make it execute the creation of the email (and then the deletion of it after sucessfully created the forwarder) ? I guess I missed something as in all the documentation and the code/example I have read, there is always necessary to do an authenticated connexion when using a cPanel API. But in the hook, the user is already connected, I should then have access to some more simple connection/API call. And I anyway cannot connect with the user as I don't have its password... What did I missed ? Is there a way to solve this ? Thanks a lot in advance for any tips. Cheers, Philippe
    Hello, This is by design, as it should produce the following error message: It's not possible to disable this functionality, but you could setup a hook that automatically creates the local email account before creating the forwarder. Thank you.

    0
  • tizoo
    Hi cPanelMichael, I finally found how to make it works. If this is usefull for someone, here is our code to let users creating a forwarder on an external email (an external Zimbra server in our case) whose domain is however defined on the cPanel server :
    #!/usr/bin/perl package TZbm::WHM; use strict; use warnings; use Cpanel::XML; use Data::Dumper; use XML::Simple; use Cpanel::Logger; # Instantiate the cPanel logging object. my $logger = Cpanel::Logger->new(); sub describe { my $tzbm_hooks = [ { 'category' => 'Cpanel', 'event' => 'UAPI::Email::add_forwarder', 'stage' => 'pre', 'hook' => 'TZbm::WHM::preAddForwarder', 'exectype' => 'module', }, { 'category' => 'Cpanel', 'event' => 'UAPI::Email::add_forwarder', 'stage' => 'post', 'hook' => 'TZbm::WHM::postAddForwarder', 'exectype' => 'module', } ]; return $tzbm_hooks; } sub preAddForwarder { my ($context, $data) = @_; my $result = 1; my $message = "Forwarder created"; # Simulate existence of the email my ($user, $domain) = split(/@/, $data->{'args'}{'fwdemail'}); my $args = { 'cpanel_xmlapi_module' => 'Email', 'cpanel_xmlapi_func' => 'addpop', 'cpanel_xmlapi_apiversion' => '2', 'cpanel_xmlapi_user' => $data->{'user'}, 'domain' => $domain, 'email' => $user, 'password' => '[somepass...]' }; my $xml = Cpanel::XML::cpanel_exec_fast($args); my $xmlRef = XML::Simple::XMLin($xml); $logger->info(Data::Dumper::Dumper($xmlRef)); return ($result, $message); } sub postAddForwarder { my ($context, $data) = @_; my $result = 1; my $message = "Forwarder created on " . $data->{'args'}{'fwdemail'}; # Remove the email my ($user, $domain) = split(/@/, $data->{'args'}{'fwdemail'}); my $args = { 'cpanel_xmlapi_module' => 'Email', 'cpanel_xmlapi_func' => 'delpop', 'cpanel_xmlapi_apiversion' => '2', 'cpanel_xmlapi_user' => $data->{'user'}, 'domain' => $domain, 'email' => $user }; my $xml = Cpanel::XML::cpanel_exec_fast($args); my $xmlRef = XML::Simple::XMLin($xml); $logger->info(Data::Dumper::Dumper($xmlRef)); return ($result, $message); } 1;
    Hope this helps and thank you for your tips, Philippe
    0
  • cPanelMichael
    Example: i am hosting a site for domain1.com. They are pointing their A record to my IP. No email hosted by me, and their MX records are pointed to a separate mail server. Before, i could forward email from my server to emailaddress@domain1.com[/EMAIL]. Now i get the error.

    Email accounts or email forwarders would not function for a domain name that has it's email hosted on a remote server. For instance, if addon-domain.tld is added to your cPanel account, but it's email is handled by a remote server, then any email accounts or forwarders you create for addon-domain.tld would not function because the domain name's email is not handled on the cPanel server.
    If this is usefull for someone, here is our code to let users creating a forwarder on an external email (an external Zimbra server in our case) whose domain is however defined on the cPanel server :

    I'm happy to see you were able to find a suitable workaround. Thank you for updating us with the outcome.
    0

Please sign in to leave a comment.