Sendmail form



I am setting up a form for a friend’s website who has webspace on dreamhost. The form requires sendmail MTA. I use a similar form on my website (different host) and it works fine but when I uploaded the same files to his site on his webspace the form no longer works. My suspicion is that the sendmail MTA does not have the same file path as my web server. Can you please let me know what that path is? I currently have the path in the php file set as: $mail_path = “/usr/sbin/sendmail”;

DreamHost e-mailed me back and said that is the correct path but I don’t understand why it isn’t working… I uploaded the exact same files to my webspace and I get the e-mails but I do not receive the e-mails from the same forms that I uploaded to DreamHost. Any ideas? Lil help? Thanks in advance.


They gave you the correct information about the path for sendmail. If you doubt that, you could always run “which sendmail” from the command line in the shell to confirm what they are telling you. :wink:

There could be any number of things that are causing the problem with your script. It could be related to PHP versions, or modes, in use (DreamHost runs either PHP4 or PHP5, and runs PHP as CGI).

Without seeing the script and digging into it, I wouldn’t know what else to tell you to check. :wink:



As rl suggested, query which sendmail in shell.

If there’s no sendmail path reported, let Support know.

Which server are you on?

Maximum Cash Discount on any plan with MAXCASH


okay so here is the php and html file i am using… i have replaced my actual e-mail address in the form with
remember, this works on my webserver but not my friends (dreamhost)
here is the php file <form.php>

<?php //SENDMAIL SCRIPT //this is a PHP script which processes the form information and formats it for the receiver's Inbox. //please reset all instances of my e-mail address to the appropriate client address //by setting it to a test email address (like, you'll be able to test the form's functionality //set sendmail variable //this is the path to the 'sendmail' directory on your server - ask your server admin for this information //this path has to be right for the form to work $mail_path = "/usr/sbin/sendmail"; //receiving address //set this to the email address which the form contents will be sent to $mail_to = ""; //email subject //this can be set to whatever you would like to appear in the Subject line of the sent e-mail //in this case, the Subject is set to say "Message from: " and the name of the sender, as entered in the form $mail_subject = "Message from: " . $_POST['name']; //initiate sendmail function ini_set("sendmail_from", $mail_from); ini_set("sendmail_path", $mail_path); if($_POST['email']) { //this if() statement determines if the message was sent successfully if(mail($mail_to,$mail_subject," From: " . $_POST['name'] . "\n Email: " . $_POST['email'] . "\n \n" . stripslashes($_POST['msg']) )) { //this string sets the message that will display if the e-mail was sent successfuly $msg = "Your message was sent as follows:

From: " . $_POST['name'] . "
Email: " . $_POST['email'] . "

Message: " . stripslashes($_POST['msg']); } //this else{} statement provides an error message is the email was not sent successfully else { //this string sets the message that will display if the e-mail was not sent successfully $msg = 'There was a problem sending your message. Please try again, or send us an email here.'; } } ?> <?php echo $msg; ?>


and here is the html file <contact.htm>

Contact Form Example


soooo… can anyone help me with this problem please???


I saw that you uploaded a script and an html page, but didn’t provide any of the other relevant information that might help me quickly see why it works on your other host but not on your friend’s DreamHost account. From my earlier response to you.

If you want me to look into your script further, I’ll give it a shot if you provide, for your account (where the script works), and for your friend’s DH account (where it doesn’t work):

  1. PHP version in use

  2. Is PHP running as PHP-CGI or mod_php

  3. A link to the output of phpinfo (so I can check certain php settings - please just link it, do not post it all here!)

Additionally, for your friends account:

  1. any errors that are displayed and any entries from the error log that are the result of running the script.

Someone else could probably figure out why it isn’t working without that, but I need all the help/clues I can get. :wink: