Remote Mail Delivery

Morning Gents,

Some of our clients host their email on servers external to our InterWorx servers (Exchange servers, Zimbra servers, dedicated mail hosts, etc.). Currently, when an application that sends email (FormMail, php’s mail() function, etc.) is executed InterWorx host, it will deliver the messages locally, as it believes it should be handling mail for that domain.

Is there a means to let InterWorx/the mail server know that it shouldn’t be handling mail for a particular domain, and to route to the external MTA specified in DNS?



You’ll need to login to the server as root and run the following:


Doing this will remove the email functionality for that account and any email sent from the server will do an mx lookup instead of delivering locally.

WARNING: Doing this will disbable the adding of subdomains and pointer domains for that account through the control panel. Should you need to add either of those after this command has been run, you’ll need to do the following:

~vpopmail/bin/vadddomain test

where test is a new password for the default postmaster@ account

then add the pointer or subdomain

then run the vdeldomain command again. We currently have a feature request to implement this in the control panel…sort of a “Turn Off Email” button or something so I imagine it will make it’s way in there in the future.


Excellent, thanks for the science. That should work great.

I look forward to seeing this included as a feature in the future!


Yes, that would be really nice to have, hope it isnt to far in the future!

I tried doing this for a domain. However, when I use the vadddomain, I’m no longer able to add any email accounts through Siteworx. The first time I tried, it gave me an error that it couldn’t chdir. I looked at the list of domains in /var/popmail/domains and noticed they were all symlinks to each domain’s mail folder. The one domain I had added back was there as a directory instead of a symlink. So, I manually added it back as a symlink to the proper mail directory with the correct permissions/ownership. Now, when I try to add an email account, it gives me the error “Error: User’s directory already exists?” HELP!

Just so you know, it appears I’m getting this error on every domain now regardless of whether I used vdeldomain or not. This is becoming very frustrating. What else could cause this to happen? My big concern is that vadddomain simply doesn’t work correctly. If it did, shouldn’t it have added back the proper symlink to the vpopmail/domains directory? Plus, I can’t think of any reason why I wouldn’t be able to add a mailbox to other domains now.

The first thing to try is running:

where is the domain of the siteworx account. Also check that the SiteWorx account hasn’t reached his storage quota, and that you don’t have a full disk. If all those things check out, open a ticket with your root and nodeworx login information, and we’ll check it out.


Well, I did that and it still doesn’t allow me to add new mailboxes on that domain. Plus, this doesn’t address all my other domains which won’t allow me to add mailboxes either. None of my domains are even close to their quotas. This is a brand new server and I’ve only started moving files over. I have a ton of hard disk available. I put in a ticket with JaguarPC and they said they’ve put in a ticket with Interworx (since they can’t fix it either) so hopefully this can get resolved quickly. I was hoping to have our server migrated before 2007 but at this rate, it doesn’t appear to be a realistic goal.


I just responded to the ticket JaguarPC has open with us, but I’ll post the response here also, in case others are curious about the solution. The problem is fixed, and it was due to the fact that someone on your box had mounted the /var partition with the nosuid and noexec flags in the /etc/fstab file:

LABEL=/var              /var                    ext3    rw,nosuid,nodev,noatime,noexec,auto,nouser,async        1 2
# mount
/var type ext3 (rw,noexec,nosuid,nodev,noatime)

The problem with this is that vpopmail and qmail are installed in the /var directory, along with their various commands (/var/vpopmail/bin and /var/qmail/bin). InterWorx has permissions to execute those commands, but not if nosuid and noexec are used. After removing the nosuid and noexec from the /var entry in /etc/fstab, I remounted the /var partition. I was then able to add and remove email accounts from various SiteWorx accounts.


Thanks. I appreciate it. I wonder how that happened though? It was working fine for about a week. Seems like it wouldn’t have worked at all.

I also noticed that you have /tmp mounted as noexec, which will cause some error messages to occur, but nearly as show-stopping as setting /var as noexec and nosuid. Did you install any security tools or run any “hardening” scripts? Scripts like that may have made those changes to further secure your box. Beyond that, your guess is as good as mine.

Yes, they did do some security hardening. And, that does kind of tie into the timeframe when I began to have issues. Does this mean JaguarPC doesn’t know all the ins and outs of how Interworx works? It kind of worries me that they don’t. Should I go ahead have them correct the /tmp problem? What should it be instead of noexec? I really don’t want to completely switch to this server with a bunch of live sites and then find out all this stuff is causing issues.

We’ve worked with JaguarPC for quite some time now, and they are a good bunch of knowledgeable guys, so I wouldn’t be too worried. Besides, that’s what we’re here for, to assist with the lesser known details in InterWorx. :slight_smile:

Edit your /etc/fstab, look for the line referring to the /tmp partition, and remove “noexec,” from the list of options. Then remount the /tmp directory.


Can’t one just comment out in /var/qmail/control/virtualdomains ?

The you can still use subdomains and pointer domains and have email routed out?

[QUOTE=sinopeach;11515]Can’t one just comment out in /var/qmail/control/virtualdomains ?

The you can still use subdomains and pointer domains and have email routed out?
I’m pretty sure you can do this. I use smtproutes to fwd all email for a couple domains to an exchange server. I just comment out the virtual domains so qmail doesn’t try to deliver it locally.

To confirm it does work on my new server like this. Contacted support (thanks Paul) and worked out one other thing to make this work.

Would it also make sense to comment out the domain on rpcthost if the server isn’t supposed to accept email for that domain at all?

If the domain isn’t in rcpthosts, the SMTP server will reject the message right away, unless, the IP sending the e-mail is allowed to relay through this server.