Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Consider the following scenario:

1) Somebody (somebody@somewhere.net) sends an e-mail to address-<id>@myhost.com where <id> is an arbitrary number. address-<id> is not an existing account on myhost.com.

2) myhost.com will send back an auto-reply to somebody@somewhere.net

3) In the body of the auto-reply message <id> will be used.

How can I implement this using postfix's pipe on myhost.com?

share|improve this question
    
This is a very Bad Idea, since spammers will try out addresses on your server often using valid sender addresses. With your scheme, these accounts will get flooded, which might get your server blacklisted. –  Floyd Sep 8 '12 at 5:45

1 Answer 1

up vote 1 down vote accepted
+50

There is a lot of solutions out there that will enable you to capture mail in various languages.

I am most familiar with doing this in cpanel, but you seem to be familiar with setting it up manually so the only piece you are missing is the code?

If so take a look at this article http://blog.thecodingmachine.com/content/triggering-php-script-when-your-postfix-server-receives-mail

There are more in depth libraries that will separate the body and recipient/sender emails so you can have all these parts in a clean fashion.(Which on also given in the example)

After you get the senders email of a non-existent email you can use PHP's mail function to let them know no mail can go to the recipient because they don't exist.

If you want to validate an email address exists here is a working example, but it uses SMTP.. and PHP not sure if this is what your going for.

http://code.google.com/p/php-smtp-email-validation/

Overall I think with these examples you can get a working code sample with some tweaking and testing.

Hope this helps. Let me know if you need more help.

EDIT

To do this in cpanel go to "Default Address" then go to "Advanced Options" then go to "Pipe to Program" then you want to put in the path to the PHP or language script/program you want to use.

share|improve this answer
    
I can use cpanel as well. Could you please explain how to do this using cpanel? –  EmreA Sep 8 '12 at 3:11

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.