Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a server running Plesk 8 and qmail as the MTA.

Now I switched one domain from multiple POP accounts to only one catchall because the mail app at the customers side (Tobit David) has the ability to deliver the mails to the right user by reading a specific header field (can be configured by the admin - that's me ;)

Most MTA's add the original recipient to the header already (mostly the field is called X-Delivered-To) and pleak does this, too. The field is called `Deliviered-To´.

However, there is on problem. Let's say I have a user called John Doe with the email address john.doe@domain.com. In the mail header the Deliviered-To field does not contain john.doe@domain.com but 29-john.doe@domain.com.

I believe that has something to do with the customer or domain I created in Plesk, since that number is unique for all recipients from this domain, but different for other domains.

Is there a way to tell qmail to add another header value with the original recipient? Or modify the current value of Deliviered-To?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Fixed! I found this link where someone had exactly the same problem:

http://shyper.net/plesk-x-delivered-to/

Quick solution

  • Create the folder /usr/local/psa/handlers/user-handlers/
  • Create a file /usr/local/psa/handlers/user-handlers/xdeliveredto with this content

     #!/bin/bash
     echo "X-Delivered-To: ${3}"
     cat
    
  • Make it executable chmod +x /usr/local/psa/handlers/user-handlers/xdeliveredto

  • Register this file as a handler in plesk

    /usr/local/psa/admin/sbin/mailmng \
         --add-handler --handler-name xdeliveredto --handler-type global \
         --executable /usr/local/psa/handlers/user-handlers/xdeliveredto \
         --context xdeliveredto --hook before-local --priority 30
    
  • ???

  • Profit!
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.