Mime::Lite module generating an error

Discussion in 'Perl Misc' started by dn.perl@gmail.com, Nov 1, 2012.

  1. Guest

    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"
    <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 = '' ; ## 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" ;

    ##=============
    , Nov 1, 2012
    #1
    1. Advertising

  2. Dr.Ruud Guest

    On 2012-11-01 06:43, 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
    Dr.Ruud, Nov 1, 2012
    #2
    1. Advertising

  3. "" <> 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.
    Rainer Weikusat, Nov 1, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aaron Brady

    SQL, lite lite lite

    Aaron Brady, Dec 29, 2008, in forum: Python
    Replies:
    15
    Views:
    744
    Aaron Brady
    Jan 1, 2009
  2. Jane Humbrey
    Replies:
    5
    Views:
    268
    Jane Humbrey
    Sep 1, 2003
  3. Replies:
    0
    Views:
    82
  4. Replies:
    2
    Views:
    395
    Tintin
    Jan 5, 2007
  5. John

    capturing error in MIME::Lite

    John, Jan 19, 2010, in forum: Perl Misc
    Replies:
    1
    Views:
    139
    Steve C
    Jan 19, 2010
Loading...

Share This Page