Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

sendmail error

by l.frankline (Hermit)
on Sep 29, 2006 at 09:57 UTC ( [id://575492]=perlquestion: print w/replies, xml ) Need Help??

l.frankline has asked for the wisdom of the Perl Monks concerning the following question:

Dear all,

I am trying to send mail to an email id, while doing so, I got an error as :
'sendmail' is not recognized as an internal or external command, operable program or batch file.

Please let me know your suggestion what is the problem exactly. Please give me your valuable suggestions.

use MIME::Lite;

  $msg = MIME::Lite->new(
                 From    =>'soft@tnq.co.in',
                 To      =>'l.frankline@gmail.com',
                 Subject =>'HTML with in-line images!',
                 Type    =>'multipart/related'
                 );
    $msg->attach(Type => 'text/html',
                 Data => qq{ <body>
                             Here's <i>my</i> image:
                             <img src="C:\temp\tendul1.jpg">
                             </body> }
                 );
    $msg->send();

Thank You,
Franklin

Don't put off till tomorrow, what you can do today.

Replies are listed 'Best First'.
Re: sendmail error
by marto (Cardinal) on Sep 29, 2006 at 10:11 UTC
    l.frankline,

    A couple of things, Firstly are you using sendmail to send email? Take a look at the MIME::Lite documentation regards the default settings and configuration:

    "On Unix systems (at least), the default setting is equivalent to:
    MIME::Lite->send("sendmail", "/usr/lib/sendmail -t -oi -oem");"

    Also the html content of your message assumes the recipient has a file called C:\temp\tendul1.jpg.

    Martin
      Also the html content of your message assumes the recipient has a file called C:\temp\tendul1.jpg

      It's worse than that. It assumes that the recipient has a file called C:{tab}emp{tab}endul1.jpg - which seems very unlikely :-)

      --
      <http://dave.org.uk>

      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg

        Jesus Jones! I didn't spot that one :) That is what I get for replying to nodes when I'm busy at work :)
Re: sendmail error
by davorg (Chancellor) on Sep 29, 2006 at 10:16 UTC

    MIME::Lite by default uses sendmail to, er... send the mail. This is described in the section Change How Messages are Sent in the documentation.

    Looks like you're trying to use it on a system that either doesn't have sendmail or has sendmail in a non-standard location. You'll need to change the configuration of the module appropriately - see also the section Sending.

    Update: Taking another look at your error message, I'm pretty sure that's a Windows message (you should really include important facts like that in you question). Windows doesn't have a sendmail program (well, not by default, you can get sendmail-a-like programs for it) so your best bet is to find the name of your network's SMTP server and use that approach.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: sendmail error
by gellyfish (Monsignor) on Sep 29, 2006 at 10:24 UTC

    Windows doesn't have a sendmail. See the section entitled "Change how messages are sent" in the MIME::Lite documentation. You will need to find out the address of an appropriate SMTP server.

    /J\

Re: sendmail error
by Khen1950fx (Canon) on Sep 29, 2006 at 10:49 UTC
    It may be that, if you're at work, someone set up MIME::Lite to use the optional module that comes with MIME::Lite called MailTool.pm. It's a subclass of MIME::Lite which doesn't provide any new methods, instead it supposedly "enhances" MIME::Lite's existing ones. Basically, it changes the default send method from sendmail to smtp. Check out the docs that davorg mentioned to see how to do send_by_smtp.

    Update: I'm sorry. I didn't catch the Windows backslashes. It's been a long day...

Re: sendmail error
by kwaping (Priest) on Sep 29, 2006 at 15:28 UTC
    Try using Mail::Sendmail instead, which is platform-independent. My company uses it in production and has had no problems.

    ---
    It's all fine and dandy until someone has to look at the code.
      So how do you attach files with Mail::Sendmail, as the OP needs? MIME::Lite allows you to specify the SMTP server just as Mail::Sendmail does, so it is no less platform independent.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://575492]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-24 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found