in reply to Re: Bouncing Email w/ Perl
in thread RESLOVED: Bouncing Email w/ Perl

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Re: Re: Bouncing Email w/ Perl
by tilly (Archbishop) on Feb 16, 2004 at 20:17 UTC
    Your complaints contradict each other.

    An atmosphere where people only dare offer concrete answers to the literal question asked is one where programmers will not improve themselves. However if you allow people to try to help each other and improve themselves, then by definition they will try to offer wisdom. That wisdom may or may not be the literal answer originally requested. So which do you prefer? That people try to give the best advice that they can, or that people deliberately let others not improve?

    Furthermore you seem to be missing basic cause and effect. To the extent that this is a shrine of elite programming gods (not very much, but bear with me) that is because the people who have been here for a while have done a lot of helping each other and improving themselves. Think about it. If interacting in this forum results in real improvement, then people here are going to become a lot better than average.

    And let me explain why this matters. A big part of being a decent programmer is understanding the design of things well enough to select clean approaches to problems. And a large part of that is knowing what you should do yourself versus what should be delegated to someone (or something) else and why. Yes you can do that but you don't want to, and here is why.. is a useful response to someone who is trying to improve.

    OK, so you aren't a server administrator. But you want to do something that is normally done by server administrators. Therefore you should learn something about the considerations that they have.

    Finally you are mischaracterizing your answers. At the moment, here is what I see for your original question:

    • An answer that says how you can do it in Perl, pointing out that it is a PITA to set up, and giving detailed instructions for how to do it in sendmail. (ie You got your answer, and a bit extra.)
    • An answer that points out the problems caused by having extra bounces.
    • A comment that says to read documentation for your MTA. In case it is not obvious to you, Abigail-II's answer refers to the fact that with many MTAs, users can write their own scripts to dynamically handle mail. Those scripts are often written in Perl, and your question didn't specify enough context to say whether or not that was the kind of script that you were writing. So despite talking about an MTA, this is a direct answer to what you might have meant.
    • You got an explanation of why it is a bad design to send bounce messages from out of an MTA.
    • You got pointed to Mail::Audit as well as a comment that you shouldn't be bouncing. Mail::Audit is meant to integrate into a mailserver and take care of the mechanics of sending the bounce etc for the programmer - in other words that is an answer.
    • You got an explanation of why it is better to reject rather than bounce. Perhaps you don't care whether you are adding to the spam problem. But if you don't care about others, then why should anyone else care about you?
    So several answers answered variations of your question directly. All provided good information. It is up to you to choose whether or not to get off your high horse and take value from it.
Re: Re: Re: Bouncing Email w/ Perl
by waswas-fng (Curate) on Feb 16, 2004 at 18:21 UTC
    If you read this thread carefully you may see that the answer you are looking for is: yes, it can be done. you can craft the bounce in perl. You can send the NDR via perl. Don't do it, because the MTA is the place for this to happen. Don't do it because spam addresses and relay routes are oft forged and the bounce that you generate will just sit in queue or go to the wrong person. Don't do it because your setup of a wildcard virtual user is silly and eating unnecessary spam attempts at random names. don't do it because there is a better way.

    You have to realize that just because those answers are not what you wanted to here they are still answers, sometimes they are the most valuable answers of all because they make you look at the problem from a wider perspective than you were capable of in the first place. Don't discount peoples responses because they are not what you wanted to hear -- they are being given to you from other admins and developers toolbox of previous experiences, that is what makes them so valuable. If you just want yes or no answers to your question without advice or requests for more info, novelty shops sell the famous 8 ball fortune tellers in every town, just keep on shaking it til you get the answer you want.


    -Waswas
How not to thank people for their advice
by mr_mischief (Monsignor) on Feb 16, 2004 at 19:28 UTC
    A bounce message is just one sent from the mail server when a message can be delivered, using the address the server uses just for such emails, to the sender's reported address.

    It's pretty simple to format a message similar to the following:

    $msg = qq{From: Mailer-Daemon\@$your_domain To: $supposed_sender_address Subject: Undeliverable message The message you sent on $date to $original_recipient could not be delivered, as that user does not exist. SMTP Error: 550, 5.1.0 unknown user Host: $mail_server_dns [$mail_server_ip] . };

    You can include whatever else you want in the message, up to and including insults to the sender's intelligence and heritage. You send this just as you'd send any other message, only in order to make it look more legitimate as a bounce, you'll want to make sure the headers and the error report show some relation where the machine addresses are concerned.

    That's as close an answer to your questions as I can give based on my understanding of your problem, as explained by you.

    The advice other monks have given regarding the usefulness of bouncing email stands, but if you want to send a bounce message, that's about all there is to it. I make no recommendations about whether or not to send bounce messages since you have been informed of the reasons for and against.

    I do know that several people have taken their own time and expended their own effort to tell you both how to do this and why you may not want to do it. Soem of those answers involed doing it from Perl and other involved doing it through other, often better, means. For their time and effort, they have been greeted with hostility and insults instead of thanks and compliments. There is an oft-quoted (or at least it used to be oft-quoted) saying on comp.lang.perl.misc that goes like this:

    "Get real! This is a discussion group, not a helpdesk. You post something, we discuss its implications. If the discussion happens to answer a question you've asked, that's incidental."
    -- nobull@mail.com in clpm
    If you wanted to refocus the discussion, you could have clarified that you do not have root access, that you want specifically to do this in Perl regardless of other options, that you just want the format of the message, and that you already know how to send a message using information taken from the original message, then that's fine. The users of this fine site would understand that, and would try to narrow the discussion. However, when you ask an ambiguous question tenuously connected to the purpose of the site with no indication that you are aware of the drawbacks to your approach, you are very likely to get responses which point out multiple ways to do something (due to your initial question's ambiguity), point out that there are ways other than using Perl to do them (because the topic generally is as applicable or more applicable to other software), and point out the drawbacks you didn't mention (to protect you (and possibly others) from what may appear to be possible shortsightedness or lack of knowledge (because your question does not display that you are aware of the implications). These are not meanspirited, exclusionary, or elitist responses. They are trying to be helpful. In order to know exactly which part of your question to answer, others must know exactly to which part you need an answer -- not to be insulted and belittled.


    Christopher E. Stith
Re: Re: Re: Bouncing Email w/ Perl
by iburrell (Chaplain) on Feb 16, 2004 at 19:52 UTC
    It is not possible to send a real bounce message from a delivered message since bounce messages come from the mail server. It is possible to send something that looks like a bounce message, but is conceptually more like an automated response.
    • The SMTP destination address is the SMTP return address. The return address is usually available in the Return-Path header of the delivered message.
    • The return address is the empty address; this is so double bounces get delivered to the postmaster of the mail server.
    • The To address is the return address.
    • The From address is usually MAILER-DAEMON at your domain.
    • The format should follow the standard for error messages.
    • Optionally, the original mail can be included as an attachment.

    Doing all this without modules is hard because you need to parse the message to find the return address, generate the bounce messages possibly with attachments, and do the SMTP transactions.

Re: Re: Re: Bouncing Email w/ Perl
by agentv (Friar) on Feb 17, 2004 at 05:40 UTC

    ...at first, I thought that maybe this was flame-bait.

    It started out pretty funny, but then degenerated.

    I don't agree that it's in character for us to transplant clpm sensibilities here. But I do have to agree with the consensus of response to this post.

    Even if you're unable to comprehend the utility of the responses to your original question, it is civilized to acknowledge the effort that went into the answers.

    And the truth is, even before this post, there were both answers and wisdom offered. What your response revealed (without you saying so) is that you simply didn't understand the responses.

    Lashing out instead of asking for help and clarification is a good way to ensure that no one else will spend 20-40 minutes crafting (and sometimes even testing) a response for you.

    ...All the world looks like -well- all the world, when your hammer is Perl.
    ---v