The Problem

I want so set a specific value for envelope sender with Email::Send::SMTP. The idea behind this being that I can have a noreply@ address as the 'From', but be able to specify an attended mailbox for any bounces. Quoth the manpage:

The envelope sender and recipients are, by default, generated by looking at the From, To, Cc, and Bcc headers. This behavior can be modified by replacing the "get_env_sender" and "get_env_recipients" methods, both of which receive the Email::Simple object and their only parameter, and return email addresses.

I have read this several times and have looked at the manpage for Email::Simple but still can't figure out what I'm supposed to do other than that I have to put:

sub get_env_sender { # something }

...somewhere. But where? And what am I supposed to put in it?

Sorry, having a Bad Documentation Comprehension Day here so any pointers would be appreciated!

Once I have this figured out, I think I might contact the module author and suggest that an example be added to the documentation.

From the Monastery Cometh the Solution

Many thanks to Anonymous Monk #1 and Anonymous Monk #2 for their responses. I have never written modules before that are based on other modules (that is, extending them) so had not come across the subclass technique. So, yesterday was one of my most valuable learning days of the year! I will now go forth and implement this.


In reply to Email::Send::SMTP - setting envelope sender by smiffy

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.