Mail forwarding: Mail is returned to sender


I went to “Edit Users” and under one user (my support user) enabled “Mail Forwarding”. It’s set to deliver to mailbox and under Forwarding to other addresses enter:

“dustin@” [PRESS ENTER] “david@” (Note: Same thing happens when only my email is entered.

I then email myself from my gmail account. I receive the following in my gmail inbox:

This is the mail system at host .

I’m sorry to have to inform you that your message could not
be delivered to one or more recipients. It’s attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

               The mail system

<dustin@> (expanded from <support@>): unknown
user: “dustin”

<david@> (expanded from <support@>): unknown
user: “david”

Final-Recipient: rfc822; dustin@
Original-Recipient: rfc822;support@
Action: failed
Status: 5.1.1
Diagnostic-Code: X-SchreiberTech-Mail-Server; unknown user: “dustin”

Final-Recipient: rfc822; david@
Original-Recipient: rfc822;support@
Action: failed
Status: 5.1.1
Diagnostic-Code: X-SchreiberTech-Mail-Server; unknown user: “david”

---------- Forwarded message ----------
From: Dustin Schreiber <>
To: support@
Date: Sun, 18 Aug 2013 18:16:24 -0400
Subject: test from gmail

I’m not sure what is going on. Does anyone know? I’m using:
Virtualmin Pro on CentOS 6.4
user@domain.tld style logins

I’ve seen some similar threads but they are slightly different and their solutions haven’t worked yet.


What you’re describing should definitely be able to work… what output do you see if you run the command “hostname” on your server? And is there a Virtual Server on your server with the same name?



Hostname is “schreibertech[dot]com” (which is in the messages I posted) and yes Virtualmin does have it as a server. Normal mail works just fine (directed directly to David or I).


There’s some circumstances where that can cause some problems… rather than just a name like domain.tld as a hostname, we’d actually recommend a full FQDN as your hostname – something like host.domain.tld.

And we wouldn’t recommend having the hostname as a Virtual Server.

You’d want to add a DNS record for it, but not actually add it as a standalone Virtual Server in Virtualmin.

To change the hostname, you can go into Webmin -> Networking -> Network Configuration -> Hostname and DNS Client. Make sure you allow it to update the /etc/hosts file.

After you’re done, verify that in /etc/postfix/, that the “mydestination” line contains your new hostname.



I tested my personal domain (dustinschreiber[dot]com) and forwarded from the default address to my address (dustinschreiber -> dustin) and that worked! Okay so it’s because of my hostname. This is going to be a pain :stuck_out_tongue: (Some options are set to figure things out using system hostname, have to find all those settings now…)

Thank you! I’ll change the hostname and re-try and make sure this works. Although I really hope I figure out WHMCS piping errors and just have that working that way so I don’t have to worry about forwarding at all


Glad that worked!

What errors are you receiving with WHMCS piping?


I managed to get past the “could not open input file” error that many were seeing thanks to: and

Specifically your advice to use Usermin. Only way I could get past that error.

Aug 18 21:12:32 schreibertech postfix/local[9005]: D5FED102914: to=, orig_to=, relay=local, delay=0.16, delays=0.12/0.01/0/0.04, dsn=2.0.0, status=sent (delivered to command: /usr/local/php54/bin/php -q /home/s/schreibertech/domains/

I get that in my logs. But WHMCS doesn’t seem to receive the message. Note that I had to enter the full path as my main PHP executioner is php 5.5 so I had to install php 5.4 to separate directory and all that (Not sure if it makes a differences)

Not sure if this is supposed to happen but entering the pipe script URL results in 500 error. (

I read about creating an email pipe script and not sure how accurate what I read was but shouldn’t that page just show a blank page? I have a feeling this is why it’s not working. Not sure why though.


Found these around same time in access log of the virtual server: - - [18/Aug/2013:21:35:02 -0400] “HEAD / HTTP/1.0” 404 - “-” “Webmin” - - [18/Aug/2013:21:35:02 -0400] “HEAD / HTTP/1.0” 404 - “-” “Webmin” - - [18/Aug/2013:21:35:02 -0400] “HEAD / HTTP/1.0” 404 - “-” “Webmin” - - [18/Aug/2013:21:35:02 -0400] “HEAD / HTTP/1.0” 404 - “-” “Webmin” - - [18/Aug/2013:21:35:03 -0400] “HEAD / HTTP/1.0” 404 - “-” “Webmin” - - [18/Aug/2013:21:35:03 -0400] “HEAD / HTTP/1.0” 404 - “-” “Webmin”

They mention Webmin so I wasn’t sure if it had something to do or not…


The access log you’re seeing is normal – that’s just Webmin performing a routing check to make sure the website is working.

It looks like you found the right entry in the email log… .that’s definitely showing the pipe.php script being called.

Do you see any errors occurring in $HOME/logs/error_log just after that entry in the maillog?


I’m sorry, I completely forgot about this thread until I decided to look through some old posts. I started college around the time of this post so I kinda just forgot.

I don’t have WHMCS at the moment, but next time I do install WHMCS, I’ll probably be back at this point and I’ll post the logs you asked about.