nsz

Well-Known Member
Apr 28, 2004
49
0
156
I just moved to a new server with Cpanel, I had a php form that e-mails from the server but now it does not. Any idea what has changed that would send out blank emails?

Thanks,

If it helps here is the script


<?php

//Declare the variables
$recipient = "[email protected]";
$subject = "Form";
$message = "Name: $firstname\nCompany Name: $companyname\nStreet Address: $streetaddy\nCity: $city\nState: $state\nZip Code: $zipcode\nPhone Number: $phonenumber\nFax Number: $faxnumber\nE-mail Address: $email\n\nInformation about property to be appraised (subject property):\n\nBorrower/Owners Name: $ownername\nSubject Address: $subjectaddress\nSubject City: $selectcity\nSubject State: $subjectstate\nSubject Zip Code: $subjectzipcode\nSales Price: $salesprice\nEstimated Value: $estvalue\nLoan Amount: $loanamnt\nProperty Type: $propertytype\nPurpose of Appraisal: $purposeappr\nFormat Needed: $formatneeded\nContact for Access: $contactaccess\nPhone Work: $phonedw\nPhone Home: $phonehome\n\n\nComments: $comments";

//mail() function sends the mail
mail($recipient,$subject,$message,"From: $email");


//Contents of form
$firstname=$_POST['firstname'];
$companyname=$_POST['companyname'];
$streetaddy=$_POST['streetaddy'];
$city=$_POST['city'];
$state=$_POST['state'];
$zipcode=$_POST['zipcode'];
$phonenumber=$POST['phonenumber'];
$faxnumber=$_POST['faxnumber'];
$email=$_POST['email'];
$ownername=$_POST['ownername'];
$subjectaddress=$_POST['subjectaddress'];
$selectcity=$_POST['selectcity'];
$subjectstate=$_POST['subjectstate'];
$subjectzipcode=$_POST['subjectzipcode'];
$salesprice=$_POST['salesprice'] ;
$estvalue=$_POST['estvalue'];
$loanamnt=$_POST['loanamnt'];
$propertytype=$_POST['propertytype'];
$purposeappr=$_POST['purposeappr'];
$formatneeded=$_POST['formatneeded'];
$contactaccess=$_POST['contactaccess'];
$phonedw=$_POST['phonedw'];
$phonehome=$_POST['phonehome'];
$comments=$_POST['comments'];
 

nickp666

Well-Known Member
Jan 28, 2005
769
2
168
/dev/null
looks as if register_globals is off on the new server, move the message variable and mail command below the $_POST definitions and it will work.

You will also want to properly clean the strings before emailing them, as the above code is vulnerable to spammers
 
Last edited:

nickp666

Well-Known Member
Jan 28, 2005
769
2
168
/dev/null
that code should work fine, if your server isnt running phpsuexec please check that you dont have 'prevent user nobody from sending email' option in WHM > tweak settings enabled

EDIT: in fact, have you actually checked the exim log to ensure the mail was delivered? could be in your gmail junk folder or you could even be blacklisted by gmail, change the address to another domain and see if it arrives
 
Last edited:

nickp666

Well-Known Member
Jan 28, 2005
769
2
168
/dev/null
that code should work fine, if your server isnt running phpsuexec please check that you dont have 'prevent user nobody from sending email' option in WHM > tweak settings enabled
Did you check that? do you have any software that may be limiting outgoing sending to certain binaries only (CSF has this option as do a couple of other things), Do you have the 'SMTP Tweak' option enabled in WHM?
 

ullalla

Well-Known Member
Jan 20, 2006
192
0
166
Hello Nick,

Thanks for your quick attention on this but I have tried this for yahoo too. And when I sent a test mail from this domain to yahoo and gmail therough webmail then it goes fine.

Please let me know if you have any info abt this.

Thanks.
 

ullalla

Well-Known Member
Jan 20, 2006
192
0
166
but when I used the email account which is on the same domain then it works . only problem for gmail and yahoo :(
 

nickp666

Well-Known Member
Jan 28, 2005
769
2
168
/dev/null
the formmail script may only allow mail to be sent to an account on your domain.

If you need it to go to a yahoo or gmail account (or anywhere off the server), setup a forward for an email like [email protected] to go to the gmail
You are indeed correct with regard to the formmailer located in /cgi-sys/ but this is a custom php script that isnt sending.
 

SageBrian

Well-Known Member
Jun 1, 2002
413
2
318
NY/CT (US)
cPanel Access Level
Root Administrator
the formmail script may only allow mail to be sent to an account on your domain.

If you need it to go to a yahoo or gmail account (or anywhere off the server), setup a forward for an email like [email protected] to go to the gmail
 

mctDarren

Well-Known Member
Jan 6, 2004
665
8
168
New Jersey
cPanel Access Level
Root Administrator
the formmail script may only allow mail to be sent to an account on your domain.

If you need it to go to a yahoo or gmail account (or anywhere off the server), setup a forward for an email like [email protected] to go to the gmail
I think you are thinking of the CGI Formmail script perhaps? Not true of PHP customer mailers.

If you use a local domain and it works then you need to check your /var/log/maillog and /var/log/exim_mainlog log files to see why it is failing for others. Perhaps that domain is listed on an RBL, or you have an SPF set up incorrectly, or DNS isn't working... multitude of possibilities...
 

ullalla

Well-Known Member
Jan 20, 2006
192
0
166
Hello,

Thanks for your replies guys , I will check for all possibilites.

Thanks.