From owner-freebsd-questions@FreeBSD.ORG Sun May 6 16:58:22 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 28C1116A400 for ; Sun, 6 May 2007 16:58:22 +0000 (UTC) (envelope-from jeffrey@goldmark.org) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 02BAA13C457 for ; Sun, 6 May 2007 16:58:21 +0000 (UTC) (envelope-from jeffrey@goldmark.org) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 77C4121E78F; Sun, 6 May 2007 12:59:03 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Sun, 06 May 2007 12:58:22 -0400 X-Sasl-enc: 8Sv5ej6Kl3U+H8u9t3wtlcu9pUOEqge55HZTjRPXZ8jV 1178470702 Received: from [10.1.10.136] (n114.ewd.goldmark.org [72.64.118.114]) by mail.messagingengine.com (Postfix) with ESMTP id 261611AF41; Sun, 6 May 2007 12:58:22 -0400 (EDT) In-Reply-To: <463DF8B5.5000906@oregnier.net> References: <463DF8B5.5000906@oregnier.net> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Jeffrey Goldberg Date: Sun, 6 May 2007 11:58:19 -0500 To: Olivier Regnier X-Mailer: Apple Mail (2.752.2) Cc: freebsd-questions@freebsd.org Subject: Re: sending email with perl X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2007 16:58:22 -0000 On May 6, 2007, at 10:48 AM, Olivier Regnier wrote: > Hello, > > I written a small script in perl to send email. > > Here is the code: > > #!/usr/bin/perl -w > use strict; > use warnings; > use MIME::Lite; > > my $msg = new MIME::Lite > From =>'me@domain.tld', > To =>'me@domain.tld', > Subject =>'test', > Type =>'TEXT', > Data =>'Hello this is a test'; > $msg -> send; > > I have a .mailrc file : > set sendmail="/root/scripts/nbsmtp.sh" Perl isn't going to know or care about what is in your .mailrc file. You should replace $msg -> send with something like $msg -> send || die "Could not send: $!" to at least get some idea of where the send attempt is failing > I installed a small mta nbsmtp and i use a shell script called > nbsmtp.sh with this line : > /usr/local/bin/nbsmtp -f me@domain.tld -h ssl0.ovh.net -d elipse -p > 465 -U postmaster@domain.tld -P password -M l -s -V I don't know anything about nbsmtp, but if it sets up an SMTP daemon on localhost then you can use the perl module Mail:Mailer to set up the mailer with something like $mailer = new Mail::Mailer 'smtp', Server => 'localhost' ; -j -- Jeffrey Goldberg http://www.goldmark.org/jeff/