At 4:25 am -0500 4/3/04, Sherm Pendley wrote:

>On Mar 4, 2004, at 12:36 AM, Baiss Eric Magnusson wrote:
>
>>I looked into the file </Library/Perl/Sendmail.pm>
>
>Is that really where you found it? If so, it's not installed >correctly. It should be in </Library/Perl/Mail/> - on Panther, ></Library/Perl/5.8.1/Mail/>.

I can't talk about this module because I don't use it, but the SendMail.pm I do use, and which I presumed was the commonly used one, is that from

<http://www.tneoh.zoneit.com/perl/SendMail/>


I append, in case it's of any use, a working example of a script that uses this module to send mail through sendmail or postfix (it makes no difference). If you try it, please change the value of @to.

JD



#!/usr/bin/perl
use SendMail;
$charset = "iso-2022-jp";

%headers = (

'MIME-version' => '1.0',
'Content-Type' => "text/html;charset=$charset",

);

$from = 'John Delacour <[EMAIL PROTECTED]>' ;
@to = split $/, 'John <[EMAIL PROTECTED]>
JD <[EMAIL PROTECTED]>' ;
$subject = "Test" ;

$body = q|
<html><body>

<pre>
百敷や

古き軒端の
しのぶにも
なほあまりある
むかしなりけり
</pre>
</body></html>
|;

$sm = new SendMail();
$sm->setDebug($sm->ON);

for $key (keys %headers) {
$sm->setMailHeader($key, $headers{$key});
}
$sm->From($from) ;
$sm->Subject($subject);
$sm->To(@to);
$sm->setMailBody($body);

if ($sm->sendMail() != 0) {print $sm->{'error'}."\n" ; exit -1; }
print "Done\n\n" ; exit 0;

Reply via email to