in reply to Re^2: Removing Headers in Perl
in thread Removing Headers in Perl

Once you've sent your email, it's too late to remove any headers.

Maybe you don't want to print the headers in the first place?

Maybe you can share with us the exact problem you are trying to solve?

Maybe this is an XY Problem?

In the transmission text, the headers are delimited from the mail body by two consecutive newline sequences (\r\n\r\n), so you could get creative with that if you save the output to a file instead of piping it to sendmail immediately.

Replies are listed 'Best First'.
Re^4: Removing Headers in Perl
by North323 (Initiate) on Nov 11, 2007 at 21:37 UTC
    i think you are correct. i do not want to print the headers. basically, i have a perl script that generates an email from a web page. when i send the email to my own outlook and i go to 'View' 'Options' I see all the received from, smtp info, and mime ver.....i basically want to see that 'Internet Headers' box to be 100% empty

      So, to translate your wish into real-world terms, you want to send a post card to yourself, without writing your address onto the postcard?

      The headers in emails are administrative information which is used for routing the mail from the source to the recipient, so you cannot leave it. Much of an email is added by the mail transfer agent (MTA) anyway and beyond your control.

      But as far as it is under your control, you can stop printing the headers.

      Maybe that hint wasn't subtle enough. The print function is used to print output. If you don't want to print something, remove the print statement.

        furthermore....barebonesmailer does not equal "your" script, just because you reproduced it here. in fact i don't see any evidence of input/mod by you at all. if you are blind to the "print" statements...maybe you should be playing with outlook and not perl.
        the hardest line to type correctly is: stty erase ^H