keefy Posted April 21, 2008 Share Posted April 21, 2008 Hi, Ive got a paid property script on my website, The script works ok on one of my sites, but the site i want it to work on seems to send the form but i never recieve it in my email... The hosting company says:- Thank you for your query This issue is occuring because there is a missing fifth parameter in your mail script. This has always been a requirement of mail scripts on our shared hosting platform but recent updates to our Linux servers (from PHP4 to PHP5) has meant that this is now always required. An example of how to use can be found below: What is the path to Sendmail? /usr/sbin/sendmail -fuser\@domainname.co.uk You need to replace -fuser\@domainname.co.uk with a valid mailbox on your account: ie -froot\@yourdomain.co.uk You must leave in the -f and make sure there is a \ before the @ An example of how to use this is displayed below: mail($to, $sub, $mess, "From: root@yourdomain.co.uk", "-froot@yourdomain.co.uk"); Please note when sending email from a script on your website either the to or from address needs to be a valid email account that is setup, eg root@yourdomain.co.uk Ive sent a email to the author of the script and he says - "I have never heard of PHP mail being used like this before!!" Below is the script from the property script, Can anyone help me change it so that its compatible to what the hosting company has said... <script language="JavaScript" type="text/javascript"> <!-- Begin var submitcount=0; function reset() { document.emailform.name.value=""; document.emailform.email.value=""; document.emailform.address.value=""; } function checkFields() { if ( (document.emailform.name.value=="") || (document.emailform.email.value=="") || (document.emailform.address.value=="")) { alert("<?php echo GENERAL_FORM_POPUP_ERROR_MESSAGE; ?>"); return false; } } // End --></script> <?php if ( $cgi->getValue ( "op" ) == "SendInformationRequest" ) { // Contact Form Spam Check for Website URl's which should not be there $SpamErrorMessage = "<p align=\"center\"><font color=\"red\">Website URLs are not permitted in the request form.</font></b></p>"; if (preg_match("/http/", "" . $cgi->getValue ( "name" ) . "")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/", "" . $cgi->getValue ( "email" ) . "")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/", "" . $cgi->getValue ( "telephone" ) . "")) {echo "$SpamErrorMessage"; exit();} if (preg_match("/http/", "" . $cgi->getValue ( "address" ) . "")) {echo "$SpamErrorMessage"; exit();} $yoursubject = "".EMAIL_SUBJECT." Ref: " . $cgi->getValue ( "propertyref" ); $emailtext = " ----------------------------------------------------------------------------- ".EMAIL_TEXT_TITLE." ----------------------------------------------------------------------------- ".EMAIL_TEXT_BODY." ".EMAIL_PD." ".EMAIL_PROEPRTY_REF." " . $cgi->getValue ( "propertyref" ) . " ".EMAIL_PROPERTY_ADDRESS." " . $cgi->getValue ( "propertyaddress" ) . " ".EMAIL_PROPERTY_PRICE." ".CURRENCY."" . $cgi->getValue ( "propertyprice" ) . " ".EMAIL_RD." ".EMAIL_NAME." " . $cgi->getValue ( "name" ) . " ".EMAIL_EMAIL_ADDRESS." " . $cgi->getValue ( "email" ) . " ".EMAIL_TELEPHONE." " . $cgi->getValue ( "telephone" ) . " " . $cgi->getValue ( "address" ) . " _____________________________________________________________ ".EMAIL_FOOTER."www.egypt4property.com/index.php?op=mi&id=" . $cgi->getValue ( "id" ) . " "; $yoursubject = stripslashes ( $yoursubject ); $emailtext = stripslashes ( $emailtext ); @mail ( $cgi->getValue ( "adminemailaddress" ), $yoursubject, $emailtext, "From: " . $cgi->getValue ( "email" ) ); ?> <br /> <br /> <br /> <p align="center"><?php echo EMAIL_SUCCESS_MESSAGE; ?></p> Thanks for any help Keefy Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted April 21, 2008 Share Posted April 21, 2008 Just as your provider states, you need to provide the additional parameter to the mail function: @mail ( $cgi->getValue ( "adminemailaddress" ), $yoursubject, $emailtext, "From: " . $cgi->getValue ( "email" ), "-fyourmail@yourdomain.whatever" ); If the author hasn't heard of it before tell him/her to go read the manual: http://www.php.net/function.mail, example 3. The options that can be provided in this manner are found in the sendmail man page: http://www.sendmail.org/~ca/email/man/sendmail.html (or "man sendmail" from the command line) In particular, the "-f" states: -fname Sets the name of the ``from'' person (i.e., the sender of the mail). -f can only be used by ``trusted'' users (normally root, daemon, and network) or if the person you are trying to become is the same as the person you are. Quote Link to comment Share on other sites More sharing options...
keefy Posted April 22, 2008 Author Share Posted April 22, 2008 Thank you very much hitman6003 It now works Does the ("adminmailaddress") need removing ? This gets the email address from the database which is the same as the -fyourmail@yourdomain.whatever without the -f @mail ( $cgi->getValue ( "adminemailaddress" ), $yoursubject, $emailtext, "From: " . $cgi->getValue ( "email" ), "-fyourmail@yourdomain.whatever" ); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.