Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text wrap in e-mail funny

Status
Not open for further replies.

gonzilla

Programmer
Apr 10, 2001
125
US
Hi,

I have a flat text file that I am reading into an array to use as the body of an e-mail:
Code:
$bodyfile = 'bodyofemail';
open(BODY, "$bodyfile") || die ("$bodyfile $!\n");
@bodyin = (<BODY>);
close(BODY);

I have some tags in this file that I am merging data from a database with which is why I have it as an external file.

When I output the array in my sendmail function, the text wraps a little weird. Here is the function...

Code:
sub sendTheMail(@)
{

#mailto = email address
#mailbody = body of the email

my ($mailto, $mailbody) = @_;

open (MAIL, '| /usr/lib/sendmail -t -oi');

print MAIL <<EOF;
TO: $mailto
FROM: $mailfrom
Subject: $mailsubj

@$mailbody       #Array reference because it was passed to the function

EOF

close MAIL;

}

The output basically wraps around, indenting each paragraph with one blank space like so..

Code:
 Hi, this is some text.  This line will be very long to show you what it looks like here on this page.  This line will be very long to show you what it looks like here on this page.  This line will be very long to show you what it looks like here on this page.  This line will be very long to show you what it looks like here on this page.

 Even short lines get indented.

 Even short lines get indented.

 Even short lines get indented.

 This is paragraph two.  This line will also be very long to show you what it looks like here on this page.  This line will also be very long to show you what it looks like here on this page.

It's odd that it does this because I have no spaces at the beginning of paragraphs as it is showing up.

Any ideas on how I can get rid of the blank?

Thanks.

-Tyler

 
It sounds like there is a setting in sendmail that is automatically wrapping lines for you. Some mailers do this on about the 72nd character. I have never touched sendmail, so can't say for certainity, but there is no reason why your code as listed above would do it.

Barbie
Leader of Birmingham Perl Mongers
 
You could attach a file to the mail, and all the formatting will remain intact

HTH
--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Thanks for all of your responses. I'm going to mess around a bit with sendmail to see if I can get it to look better - otherwise, they are ok with what it looks like now.

I would attach the file to the e-mail, but the project spec calls for it to be in the body of the e-mail.

Thanks again.

-Tyler

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top