in reply to Removing Headers in Perl

The big problem in your program is that you are accepting untrusted user input and pass that on to the sendmail program. You will need to make sure that the $fromEmail, $formSubject, $dateFormat, $fromName, $remoteHost, $remoteAddress, and the $ENV{'HTTP_USER_AGENT'] all are well-formed and especially do not contain newlines.

Personally, I would reject anything that contains a character outside of [\x20-\x7f], but that might preclude people with accents in their name.

Have you looked at the safer and well-maintained offerings from the NMS Posse ? They also have a form mailer, which might be what you need.

Replies are listed 'Best First'.
Re^2: Removing Headers in Perl
by North323 (Initiate) on Nov 11, 2007 at 20:54 UTC
    thats great but how do i remove the headers from my emails when i sent them

      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.

        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