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

Can someone see my script and tell me why I might not be getting emails through it? It's not erroring out or anything but I'm not getting emails.
open(MAIL, "|$sendmail -t") or die "Cannot open sendmail: $sendmail: + $!"; print MAIL 'From: no@reply.com\n'; print MAIL "To: $email\n"; print MAIL "Subject: $subject\n\n"; print MAIL "confirmation"; close(MAIL);

Replies are listed 'Best First'.
Re: Small email script not working
by wind (Priest) on Mar 24, 2011 at 02:55 UTC
    This line is your problem. You need to interpolate the \n
    print MAIL 'From: no@reply.com\n';
    change to
    print MAIL "From: no\@reply.com\n";
Re: Small email script not working
by GrandFather (Saint) on Mar 24, 2011 at 02:57 UTC

    Maybe not immediately helpful, but MIME::Lite is an easier way of composing and sending email.

    True laziness is hard work
Re: Small email script not working
by Anonymous Monk on Mar 24, 2011 at 02:58 UTC
    $sendmail is undefined, as is $email and $subject

    Or if you define them somewhere, they contain the wrong thing

    Or something else that $sendmail would print to STDERR

    See Email::Send