First check that your path is correct to the sendmail. That's not the path to mine, and if you are typing this out of a book, its probably not the path your ISP has. Check.. make sure
Second, check that the user you have sending the email exists on the sever. You have admin@yourhost.com Make sure "admin" is a user, most ISP's won't allow you to send email from a non-existant account, to keep spamming down.
Third " or die" is a valid end to a program. Have it log something on the die, so you got some kind of message to refer to. Nothing is being returned, so debugging something like this will be a bear if you don't get some type of responce from the program that everything went well, or what might have gone wrong.
I rarely use || die on cgi's .. I have them log or return an error code. This keeps things nice and simple to maintain later.
Lastly.. I don't think those single quotes should be there. I'm not sure why they are there, and I would try removing them. Change
print MAIL "Name: $formdata{'name'}\n";
print MAIL "email: $formdata{'email'}\n";
print MAIL "message: $formdata{'message'}\n";
to this
print MAIL "Name: $formdata{name}\n";
print MAIL "email: $formdata{email}\n";
print MAIL "message: $formdata{message}\n";
Hope that helps.
Glenn H.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.