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.

This is my first post to serverfault, so I hope you excuse me for asking what may seem like an obvious question. I have tried running a few Google searches, but I really don't know where to begin.

Here's the scenario: I have an online application that sends emails on behalf of the users (at their request, of course). The destination server then sends an autoreply. When the autoreply comes in (from a specified address, each time), I want to forward all of the mails from that address to a PHP script that will then do something else with the message.

Here's the catch: the address that I am using to send the message does not actually exist on my server. I basically set the "From" field to username@mydomain.com, even though they don't actually have a user account/email address on my system (nor do I want to create one, for security purposes.) So I will have to somehow create a filter that catches ALL incoming messages from this particular address. Is this doable, and if so, how do I do it? I'm running Dovecot on an Ubuntu server. I know next to nothing about configuring servers, so I'm going to need very specific, step-by-step instructions.

share|improve this question
    
I just realized that the problem I was trying to solve was due to a coding error. My bad. –  blainarmstrong Jul 5 '13 at 0:40

2 Answers 2

Don't send mail From: a nonexistent address if you're actually expecting a reply. Use an address which actually exists, and then your app doesn't need to do anything more than check the mail.

share|improve this answer
    
I tried that: I originally set the message's "from" field to their registered address. (I even tried it with my own). For some reason, the reply never came, leading me to believe that the server is set up to refuse messages coming "via" another server. –  blainarmstrong Jul 4 '13 at 3:59
    
More specifically, I'm trying to set it up so that the reply actually gets to the person who sent the mail. There is nothing in the reply indicating who the mail is for, so I'm left with few options. –  blainarmstrong Jul 4 '13 at 4:01
    
If you set it to their address, a reply would go to them! And, that's exactly NOT what you said in your original question. Please work on clarifying it so that you can get a usable answer. –  Michael Hampton Jul 4 '13 at 4:01

I really don't see what security you think you are getting by not setting up a real address to send the message from. You only need an alias which delivers to the bit bucket (/dev/null) although you may want to process bounce messages to detect invalid clients.

A few suggestions:

  • Follow good practices when sending email. Make sure you have appropriate DNS entries or use a correctly configured relay server to send the messages.

  • Use a real donotreply address as the from address. This address can be configured to send all incoming mail to the bit bucket.

  • Use a description like On behalf of John Doe as the descriptive name for the From address.
  • Use the users address as the reply-to address if required.

  • Consider using procmail or a system filter to match and process the incoming mail.

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.