Maybe this question doesn't belong here, but I try anyway.
I have written a perl-script which creates a text-file from information in a datebase.
One line can become very long when there are a lot of related records in one table.
When created the file looks OK, but when I send the file as attachement to somebody and they look at the file it is cut-off.
It is broken up in chuncks of 2042 characters, which are broken up in 3 lines: 2 lines of 999 characters ending with a CR/LF and 1 line of 44 characters ending with "!" and CR/LF.
I think it has to do with the MIME-TYPE which I use to send the file.
Here is the code-part:
sub emailFile
{
my $to = shift;
my $subject = shift;
my $content = shift;
my $filename = shift;
my $nette_naam = shift;
my $command = "|/usr/lib/sendmail -f $from $to";
open(MAIL, $command) || die("Can't open sendmail!!\n");
print MAIL "To: $to\r\n";
print MAIL "Subject: $subject\r\n";
print MAIL "MIME-Version: 1.0\r\n";
print MAIL "Content-Type: multipart/mixed; boundary=\"----=_NextPa
+rt_000_002C_01C2C170.A5EE7000\"\r\n";
print MAIL "\r\n";
print MAIL "This is a multi-part message in MIME format.\r\n";
print MAIL "\r\n";
print MAIL "------=_NextPart_000_002C_01C2C170.A5EE7000\r\n";
print MAIL "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
print MAIL "Content-Transfer-Encoding: 8bit\r\n";
print MAIL "\r\n";
print MAIL $content . today() . "\r\n";
print MAIL "\r\n";
if (open(FILE, $filename))
{
print MAIL "------=_NextPart_000_002C_01C2C170.A5EE7000\r\n";
print MAIL "Content-Type: application/octet-stream; name=\"$ne
+tte_naam\"\r\n";
print MAIL "Content-Transfer-Encoding: 8bit\r\n";
print MAIL "Content-Disposition: attachment; filename=\"$nette
+_naam\"\r\n";
print MAIL "\r\n";
while (<FILE>)
{
print MAIL $_;
}
close (FILE);
}
print MAIL "------=_NextPart_000_002C_01C2C170.A5EE7000--\r\n";
print MAIL "\r\n";
close(MAIL);
}
Any help is welcome, and if my post here is wrong, pls tell me were I should post.
Sunclair
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.