|
ru.cgi.perl- RU.CGI.PERL ------------------------------------------------------------------ From : Alexander Russkih 2:468/75 15 Dec 2000 11:32:06 To : All Subject : [part 2] Re: PERL+SENDMAIL: -------------------------------------------------------------------------------- .MSGID: 2:468/75 230e2a79 .REPLY: ddt.demos.su 9701ada9 .RFC-Path: nomebase.deadface!not-for-mail .RFC-References: <90tdom$20ss$1@ddt.demos.su> .RFC-NNTP-Posting-Host: homebase.deadface .RFC-X-Trace: homebase.deadface 976869127 590 10.0.10.1 (15 Dec 2000 08:32:07 GMT) .RFC-X-Complaints-To: usenet@homebase.deadface .RFC-NNTP-Posting-Date: 15 Dec 2000 08:32:07 GMT .RFC-X-Accept-Language: ru, uk, en Subject: Re: PERL+SENDMAIL: =?koi8-r?Q?=CF=D4=D0=D2=C1=D7=C9=D4=D8=20=C6=C1=CA=CC?= Reply-To: alex@unio.kherson.ua * Continuation 1 of a split message * ($!)."; return(9); } print SMTP "Attachment:\t$filename$CRLF"; print SMTP "Encoding:\tNone$CRLF$CRLF"; # Attach the text file, converting any lines with a single period while (<TEXT>) { s/^\.([\n\r\f]+)/..$1/; print SMTP } close(TEXT); print SMTP "\n\n"; } # Attach uuencoded file. elsif ($encoding eq 'uuencode' && -e $attach_file) { print SMTP "Attachment:\t$filename$CRLF"; print SMTP "Encoding:\tUUEncoded$CRLF"; print SMTP "begin 600 $filename\n"; $uuencoded_data = &uuencode($attach_file, 'open->attach_file'); if (!$uuencoded_data) { return(10) } print SMTP $uuencoded_data; print SMTP "`\nend\n\n"; } # Attach MIME files elsif ($encoding eq 'base64' && -e $attach_file) { print SMTP "--$mime_id$CRLF"; # If it is a text file, print a text content type, otherwise print # an octet stream. if (-T $attach_file) { print SMTP "Content-type: text/plain; charset=US-ASCII; name=\"$filename\"$CRLF"; } else { print SMTP "Content-type: application/octet-stream; name=\"$filename\"$CRLF"; } print SMTP "Content-transfer-encoding: base64$CRLF$CRLF"; # Encode the data with base 64. $base64_encoded_data = &base64_encode_file($attach_file); if (!$base64_encoded_data) { return(11) } print SMTP "$base64_encoded_data$CRLF"; } } # Print the final mime id if necessary if ($mime_id) { print SMTP "--$mime_id--$CRLF" } # End the conversation print SMTP "$CRLF.$CRLF"; sysread(SMTP, $_, 1024); if (!/[^0-9]*250/) { $Error_Message = $_; return(7) } # Disconnect from the server if (!shutdown(SMTP, 2)) { $Error_Message = "Could not shut down server ($!)."; return(8, @bad_addresses); } elsif (@bad_addresses) { return(2, @bad_addresses); } else { return(0) } } 1; -- С уважением, Александр Русских mailto:rsalex@bigfoot.com http://www.unio.kherson.ua/~rap --- Mozilla 4.7 [en] (X11; I; Linux 2.2.17 i586) * Origin: Homebase DEAD'FACE. Unio Mystica Group. (2:468/75) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.cgi.perl/1265239184.html, оценка из 5, голосов 10
|