Article View: pl.comp.lang.perl
Article #718Re: prosty mailer
From: Piotr Piatkowski
Date: Sun, 23 Nov 1997 18:58
Date: Sun, 23 Nov 1997 18:58
57 lines
2561 bytes
2561 bytes
Adam Glowacki <webmaster@baunet.de> wrote:
: Piotr Piatkowski wrote:
:>
:> sub send_mail {
:> my( $from, $to, $subject, $body ) = @_;
:> open( SM, "|/usr/sbin/sendmail -f$from $to" )
:> or die "open sendmail: $!";
:> print SM "From: $from\n";
:> print SM "To: $to\n";
:> print SM "Subject: $subject\n";
:> print SM "Mime-version: 1.0\n";
:> print SM "Content-type: text/plain; charset=ISO-8859-2\n";
:> print SM "Content-transfer-encoding: 8bit\n";
:> print SM "\n";
: Az do tego miejsca zamiast LF chyba musi byc CRLF.
Nie chce mi się szukać po RFC, ale jesteś tego pewien? Wydaje mi się
ĹĽe \r\n jest obowiÄ…zkowe tylko przy transmisji w sieci (np. przez
port 25). Ale pewności nie mam. Tak czy inaczej - to co napisałem
działa z powodzeniem od kilu tygodni ;-)
:> print SM "$body";
:> close SM
:> or die "close sendmail: $!";
:> }
:>
: Ja bym proponowal wpisanie listu do zmiennej i wywolanie programu
: sendmail
: w nastepujacy sposob (sciezki zaleznie od systemu):
: system( "/usr/lib/sendmail -t <$tresc_listu" );
: gdzie $tresc_listu:
: From: xxxxx\r\n
: To: xxxxx\r\n
: Subject: xxx\r\n
: \r\n
: bla bla\n
: bla bla\n
He??? Znaczy się po rozwinięciu:
system( "/usr/lib/sendmail -t <From: xxxxx\r\nTo: xxx\r\n ...." ) ???
: Jesli pole From: jest podane w naglowku, to system u mnie nic nie
: dopisuje.
Tak dokładnie, to:
-fname Sets the name of the ``from'' person (i.e., the
sender of the mail). -f can only be used by ``trusted''
users (normally root, daemon, and network) or
if the person you are trying to become is the same as the
person you are.
--
Piotr PiÄ…tkowski, Uczelniane Centrum Informatyki, AGH Krakow, POLAND
Technical Details
Message-ID:
<659ucu$lte$1@galaxy.uci.agh.edu.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.nask.pl!news.onet.pl!agh.edu.pl!agh.edu.pl!not-for-mailReferences:
<65428n$qmf$1@galaxy.uci.agh.edu.pl> <Pine.LNX.3.95.971122212102.3318B-200000@wizard.ae.krakow.pl> <6586sr$ctm$1@galaxy.uci.agh.edu.pl> <347851BE.7F82@baunet.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.nask.pl!news.onet.pl!agh.edu.pl!agh.edu.pl!not-for-mail From: Piotr Piatkowski <kompas@galaxy.uci.agh.edu.pl> Newsgroups: pl.comp.lang.perl Subject: Re: prosty mailer Date: 23 Nov 1997 19:58:38 +0100 Organization: University of Mining & Metallurgy Lines: 57 Message-ID: <659ucu$lte$1@galaxy.uci.agh.edu.pl> References: <65428n$qmf$1@galaxy.uci.agh.edu.pl> <Pine.LNX.3.95.971122212102.3318B-200000@wizard.ae.krakow.pl> <6586sr$ctm$1@galaxy.uci.agh.edu.pl> <347851BE.7F82@baunet.de> NNTP-Posting-Host: galaxy.uci.agh.edu.pl Mime-Version: 1.0 X-Newsreader: TIN [UNIX 1.3 unoff BETA 971018; sun4m SunOS 5.5.1] Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit