Many thanks to chromatic btrott and even BBQ on my last post about getting a filehandle to write to with Mailer::Mail. I posted some additional info yesterday, but I fear no-one has seen it and we've moved to another page, so, just on the off-chance someone has some additional thoughts, herein the additional information:
I can print() to $mailer but I cannot write() to it.
Here are the errors.
Write on closed filehandle at ./format_eg.pl line 77.
Write on closed filehandle at ./format_eg.pl line 78.
Lines 77 and 78 are the two write statements in the code below. The code works on STDOUT and a normal file. Here is the code.
sub Write_Data{
format STDOUT =
@<<<<<<<<<<@<<<<<<<<<<<@<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<
shift(@printrows), shift(@printrows), shift(@printrows),
shift(@printrows)
.
my $To = 'dvmrgn@home.com';
my %mail_header = ('To', $To,
'From', 'webmaster@onlinerenter.com',
'Subject', 'Test of New Clients Report'
+);
my $mailer = new Mail::Mailer 'smtp',
Server=>'smtp.telusplanet.net';
$mailer->open(\%mail_header);
my $ofh = select($mailer);
$~ = "STDOUT";
write ;
write ;
$mailer->close;
select($ofh);
} # End of write_data
There endeth the question, much thanks in advance if you have some insight/wisdom to share.
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.