Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Mime::Lite module generating an error

Reply
Thread Tools

Mime::Lite module generating an error

 
 
dn.perl@gmail.com
Guest
Posts: n/a
 
      11-01-2012

I can send email from my linux server with 'mailx' command. I could
also send an email from it using Mime::Lite module until recently.
Today the same old working module has started failing, and it gives an
error: Illegal Seek.
What could be happening?

The mailx cmd runs well: mailx -s "subject1 sub 2"
http://www.velocityreviews.com/forums/(E-Mail Removed) <aaa

cmd: ./local-send-mail-test.pl
The error:
rv = 1, Illegal seek
An email, with subject: (sample subject), has been sent to myname-etc-
etc


Code as below : (You will need to edit the line marked 'edit-this-
line' before running it.
#!/usr/local/bin/perl

use strict ;
use warnings ;

use MIME::Lite;

my $my_email = '(E-Mail Removed)' ; ## edit-this-line
my $subject = 'sample subject' ;
my $message = "line 1, line 1" ;
my $msg_body_type = 'text' ;
my $msg = MIME::Lite->new(
From=>$my_email,
To => "$my_email",
Subject => $subject,
Type => 'multipart/related',
);
$msg->attach(
Type => $msg_body_type, #-# text/html or text
Data => $message
);
my $rv = $msg->send() ;
print "rv = $rv, $! \n\nAn email, with subject: ($subject), has been
sent to $my_email\n\n" ;

##=============
 
Reply With Quote
 
 
 
 
Dr.Ruud
Guest
Posts: n/a
 
      11-01-2012
On 2012-11-01 06:43, (E-Mail Removed) wrote:

> my $rv = $msg->send() ;
> print "rv = $rv, $! \n\nAn email, with subject: ($subject), has been
> sent to $my_email\n\n" ;


You are printing "$!" for no good reason.

It is a special global variable, that can basically have any value.
You should only print that variable if you know that there was an error.
Now it is probably just about something that send() was trying.

--
Ruud

 
Reply With Quote
 
 
 
 
Rainer Weikusat
Guest
Posts: n/a
 
      11-01-2012
"(E-Mail Removed)" <(E-Mail Removed)> writes:
> I can send email from my linux server with 'mailx' command. I could
> also send an email from it using Mime::Lite module until recently.
> Today the same old working module has started failing, and it gives an
> error: Illegal Seek.
> What could be happening?


[...]

> my $rv = $msg->send() ;
> print "rv = $rv, $! \n\nAn email, with subject: ($subject), has been
> sent to $my_email\n\n" ;


Most likely, some code in the C libary called lseek on the underlying
file descriptor and this call failed because the file descriptor
referred to the write end of a pipe connecting your code to a sendmail
process and pipes are not seekable. $! is the Perl name for errno and
the current value of errno isn't generally meaningful except when some
system or C library call returned an error indication to the
caller. In this given case, unless ->send() returned 'false', no error
has occurred.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
module for generating captcha images Irmen de Jong Python 0 08-03-2008 05:19 PM
Any python Module for generating DocBook? Tommy Nordgren Python 0 08-25-2007 08:18 PM
Re: module docstring, documentation,anything? please note is the module type/object NOT some module Maric Michaud Python 0 06-24-2006 12:42 PM
MySQLdb module generating errors amaltasb@gmail.com Python 0 04-11-2006 12:58 PM
Framework/module for generating HTML documentation Ryan Ginstrom Python 1 04-04-2006 02:28 PM



Advertisments