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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Sendmail Help!
by davorg (Chancellor) on Dec 07, 2006 at 14:39 UTC

    You're not putting a blank line between your headers and body.

    Also, this is a FAQ. How do I send mail?

    Notice that the example just uses a "From:" header in the message. I don't see why that wouldn't work.

    Why don't people read the FAQ any more?

    Also. Why use:

    $mailto[0]="person1\@gmail.com"; $mailto[1]="person2\@hotmail.com"; $mailto[2]="person3\@yahoo.com";

    Instead of:

    $mailto[0]='person1@gmail.com'; $mailto[1]='person2@hotmail.com'; $mailto[2]='person3@yahoo.com';

    Or even:

    @mailto = qw( person1@gmail.com person2@hotmail.com person3@yahoo.com );
    --
    <http://dave.org.uk>

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

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Sendmail Help!
by roboticus (Chancellor) on Dec 07, 2006 at 14:46 UTC
    Anonymous:

    Given your PM handle, I would think that the address is correct. What's the problem? 8^)

    Anyway, you should specify a 'From:' address in your message. Sendmail may be inserting the 'anonymous' one for you. In one of my apps, I have a 'From: MailBot@my.domain.com'. Also, I believe that you're supposed to have a blank line between the mail headers and the body. (I also seem to recall something about it either wanting (or tolerating?) carriage returns in addition to the newlines.... I'll have to dig out the appropriate RFC to check.)

    --roboticus

Re: Sendmail Help!
by jbert (Priest) on Dec 07, 2006 at 16:22 UTC
    You aren't composing the mail correctly (no From: header, no blank line between headers and body) and your ISP is adding one. As other people have said, please read the FAQ on this, because web->mail scripts have been a favourite source of errors for over a decade.

    If you've ever run a web server and looked at the error logs, you'll see there are spammers still trying to find formmail.pl exploits from eons ago.

    Your program in its current form might not be exploitable (hard to tell - since I don't know where you get $name from - if it's from the form can I enter ';rm -rf /' or similar and have some fun?) but things get extended over time and you may end up providing a spammer's gateway (or an exploitable hole on your ISP's webserver).

    You might also want to look into taint checking if you haven't already. Have fun.

      The $name is a name from a database and it is checked before it gets to the database, I am filtering for any strange character. It should be safe.
Re: Sendmail Help!
by imp (Priest) on Dec 07, 2006 at 14:45 UTC
    I would recommend using a module for sending mail, even for cases as simple as this. My most recent experience is with MIME::Lite, which is quite good.

    You should assert that the $name field does not contain any newlines or special characters, otherwise spammers will use that field to embed another mail. A script I wrote early in my career had that problem, and it wasn't long before it was exploited.

    I also recommend sending mail via SMTP instead of through a local executable, as it will allow you more flexibility and portability. The sendmail implementation of the sendmail command could have different options than the postfix implementation, or even other sendmail versions.

Re: Sendmail Help!
by andyford (Curate) on Dec 07, 2006 at 14:37 UTC

    It would be better if you showed us a complete, but simple, test so we could help you better.
    Are you sure that $name is getting set properly to something?
    Perhaps a debug line like

    print "name var is set to $name\n";
    might be useful.
    Are you doing "use strict", "use warnings", "use diagnostics"?

    non-Perl: Andy Ford

Re: Sendmail Help!
by geekphilosopher (Friar) on Dec 07, 2006 at 14:35 UTC
    Does the same problem occur if you use something like Email::Send::Sendmail? Overkill for a simple script perhaps, but it might work for you.
Re: Sendmail Help!
by Anonymous Monk on Dec 07, 2006 at 15:52 UTC
    I don't want this anonymous to show, I wnat to get rid of it.
    If your ISP decides to insert it, there is nothing you can do.
Re: Sendmail Help!
by ColtsFoot (Chaplain) on Dec 07, 2006 at 14:07 UTC
    I think that the last line of a message should contain a . (period)
    on a line on its own.
    print MAIL "New Form Entry is at:\n.\n";
    Hope that helps
      No,that did not solve the problem!