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

In reply to How not to thank people for their advice by mr_mischief
in thread RESLOVED: Bouncing Email w/ Perl by soffen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.