venimfrogtongue has asked for the wisdom of the Perl Monks concerning the following question:

I have created a few small perl scripts and one I was never able to complete no matter how simple I try to make it is the contact form. It never works for me. I was wondering if someone could take a look at the snipplet below and help me figure out how I can do a similar syntax of this without using a perl module. My server refuses to install more and will not allow me to install mods, so I need to use plain sendmail. Thanks!
sendmail( To => $adminmail, From => $from, Subject => $subject, Message => $message ) or die $Mail::Sendmail::error;

Replies are listed 'Best First'.
Re: Sendmail
by Kanji (Parson) on Mar 29, 2002 at 01:23 UTC

    If you're not allowed to install your own modules, then I'd strongly urge you to find a more accomodating provider.

    But to answer your question ...

    open SENDMAIL, "| $path_to_sendmail -t -oi" or die "..."; print MAIL <<END_OF_MESSAGE; To: $adminmail From: $from Subject: $subject $message END_OF_MESSAGE

        --k.


      Thanks Kanji. I knew how to do your method of doing it already, but I never got it to work, lol. I can get any other program I make to work but contact forms :) From the looks of it, that might be the only reasonable way to accomplish this without a module.

      Thanks for your help!

      sulfericacid

Re: Sendmail
by erikharrison (Deacon) on Mar 29, 2002 at 02:58 UTC

    While you could handle opening the pipe to Sendmail yourself, it's better for a bazillion reasons to use a module. And you always can, if you're crafty (and your host is cruel). The easist for you is to cut and paste the entire module into a BEGIN block, and put it inside your script, like so:

    #usr/bin/perl -wT package main; use strict; # Your code goes here # Whatever you need # To do, using the module #Might wanna add #some blank line for clarity BEGIN { #cut 'n' paste module here }
    Cheers,
    Erik

      ..or with the "use" syntax, simply include the local version of the module (that you have copied in as a support file).

      This tactic does NOT always work however - many perl modules do use C and other compiled portions - these types of modules, of course, will not function by just being copied in, in most cases.  However, in Mail::Sendmail, as documented by the author in it's POD, "Only requires Perl 5 and a network connection." - and is a suggested method in PerlDoc's Portable Code page.

      - so fly free, and enjoy the easy use as a local module.

      Update:
      This might help as well - look towards the bottom for the part on "what if i do not have permission to install..." - thanks footpad!



      *G*

        Thanks growlf! I am going to take a look at the resources you posted.

        Thanks again!

        sulfericacid

      Thank Erik!

      I never played with modules so I didn't know if it was just plain text or whatnot. I might use your idea and use it within my script. Just have to think about it for a little bit, don't want to do anything my webhost would cancell me for. Their the only webhost I can get for my page, lol.

      I think I am going to go read on mail::sendmail now, thanks for your help!!!

      Aaron

Re: Sendmail
by zengargoyle (Deacon) on Mar 29, 2002 at 03:25 UTC