edimusrex has asked for the wisdom of the Perl Monks concerning the following question:

I hope this is a super simple question for someone. I recently have had the need to switch a perl mailing script from using postfix to using straight smtp authentication. I settled on using Net::SMTP::SSL to do so, however, when I send an email I get unwanted header information in the body of the email. Is any one familiar with a way to suppress this? I do not want to see the header info at all in the emil. Here is a snippet of my code

while (<FILE>) { my $reciever = $_; $reciever = trim($reciever); print "sending to $reciever\n"; $smtp->mail($sender); $smtp->recipient($reciever); $smtp->data(); $smtp->datasend("To: <$reciever> \n"); $smtp->datasend("From: $sender_name <$sender> \n"); $smtp->datasend("Content-Type: text/html \n"); $smtp->datasend("Subject: $subject"); $smtp->datasend("\n"); $smtp->datasend($body); $smtp->datasend("\n"); $smtp->dataend(); } $smtp->quit;

(Keep in mind I am just testing and haven't written in any error checks or anything, I know some of you guys are pretty anal about that). Anyways, here is the output of the email I receive

This is a test Date: Fri, 10 Jul 2015 15:56:55 +0000 Message-ID: X-SES +-Outgoing: 2015.07.10-54.240.8.92 Feedback-ID: 1.us-east-1.vzpt/HASc5 +V1wxVDR8t2uShTrsuQZdG+MWGkCosTfe0=:AmazonSES X-AnalysisOut: [v=2.1 cv +=VYbjPTZ9 c=1 sm=1 tr=0 b=1 a=l4O7Z3VSsQrM948uWWFV] X-AnalysisOut: [m +A==:117 a=l4O7Z3VSsQrM948uWWFVmA==:17 a=hoWM_M7QAAAA:8 a=] X-Analysis +Out: [B8ibFTVmAAAA:8 a=YlVTAMxIAAAA:8 a=zOBTXjUuO1YA:10 a=MN8dvW] X-A +nalysisOut: [ad-vo2-9TkQDAA:9 a=dJ6bhRxdHoAA:10] Received-SPF: Pass ( +s12p02m024.mxlogic.net: domain of amazonses.com designates 54.240.8.9 +2 as permitted sender) X-Spam: [F=0.2000000000; B=0.500(0); STSI=0.50 +0(10); STSM=0.500(10); CM=0.500; CY=0.50; MH=0.500(2015071008); S=0.2 +00(2014051901); spf=0.500; SC=] X-MAIL-FROM: X-SOURCE-IP: [54.240.8.9 +2]

Everything beyond "This is a test" I would like gone

Thanks

Replies are listed 'Best First'.
Re: Headers appearing in email body
by dave_the_m (Monsignor) on Jul 10, 2015 at 16:09 UTC
    Looks like you're missing a newline at the end of subject. Try
    $smtp->datasend("Subject: $subject\n");

    Dave.

      you are correct! Thanks. I figured it was something easy