Hi I have the below script (extracted pertinent bits). The connection to the mail server times out if there is more than about 10 lines of text (sometimes less)
There is no issue with how many attachments I can send, so getting a bit stumped Example below with specimen text (anonymised) The body,subject and address come via a sqlite db lookup run by a Gtk app. And it is a subscribers list so definitely not spam. Any ideas appreciated $text =" Talk and Walk for Our NHS Friday 7th October. MEETING 4.30 to 6.30 Our Plans for Our NHS: as Derbyshire community hospitals and wards are threatened with closure, the Big Plan (STP) is to slash Derbyshire's health spending by £400 million over the next 5 years. We can't let this happen. Join us at Belper Strutts, Derby Road. (DE56 1UU) Saturday 8th October. WALK ACROSS DERBYSHIRE/SAVE OUR NHS. Leave Belper Market Place at 10.00. Leave Bakewell Park at 10.00. Walk to Matlock County Hall for Rally at 3.00. Or join us on the way. Derbyshire Keep Our NHS Public: xxxxxxxxxxxx...@gmail.com Tuesday 11th October, 7.30 Derby Guildhall Townsend Theatre's moving, funny, powerful play about the Spanish Civil War. "Dare Devil Ride to Jarama." Tickets (£10.75) from http://xxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx@xxxxxxxxxx or phone xxxxxxxxxxxxx Derby People's History." use Net::SMTP::SSL; use MIME::Base64; use Email::Sender::Simple qw(sendmail); use Email::MIME; use IO::All; use Email::Sender::Transport::SMTPS; sub sendemail { my ($fname,$email,$rowid,$momstatus,$labstatus,$subject,$body)=@_; print $fname,"\t",$email,"\t",$subject,"\t",$rowid,"\t",$status1,"\t",$status2,"\n"; my $message; $message= " Hi $fname $body"; print $rowid,"\n",'lp_status'."\t",$labstatus,"\t".'momstatus'."\n"; my $footer; if (<check1>){ $footer="\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, <url hereuuuuuuuuuuuuuuuuuuuuuuuuuu> "; } if (check2){ $footer=$footer."\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, <urluuuuuuuuuuuuuuuuuuuuuuuuuu> } my @attachments= qw/attachments go here/; my @parts; push @parts,Email::MIME->create( body => $message."\n".$footer, attributes=>{content_type =>'text/plain'} ); foreach my $line (@attachments){ my $mime=`file --mime-type $line`; my @type=split /: /,$mime; chomp $type[1]; my $mime_type=$type[1]; push @parts, Email::MIME->create( body => io('/home/mike/'.$line)->binary->all, attributes => { encoding=>'base64', filename => $line, content_type => $mime_type, name=>$line, disposition => 'attachment' } ) } $message=$body."\n".$footer; my $multi = Email::MIME->create( header_str => [ To => $email, From => 'm.mar...@momentumderbyshire.co.uk', 'Reply-To' => 'm.mar...@momentumderbyshire.co.uk', 'List-Unsubscribe'=>'m.mar...@momentumderbyshire.co.uk', 'Disposition'=>'bulk', Subject => $subject ], parts => [@parts, ], ) ; my $transport = Email::Sender::Transport::SMTPS->new( host => 'mail.momentumderbyshire.co.uk', port => 587, sasl_username => 'm.mar...@momentumderbyshire.co.uk', sasl_password => 'M0m3ntum16', debug => 0, # or 1} ); sendmail ($multi, {transport=>$transport}); } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/