Forum Moderators: coopster
I don't know specifically where to post this concern. My problem is either
my PHP code mail() or Yahoo Small Biz Hosting.
I have a form that when you click Submit, it calls a php file and will send it
to email. I uploaded the files in Yahoo Small Biz Hosting, and when I use the
form, I am not able to receive any email from the form even the spam folder,
nothing's there.
BUT when I upload the files to another hosting I am able to receive the email
it goes to my spam folder.
1. What seems to be the problem?
2. Is PHP enabled by default on Yahoo Small Biz Hosting?(I don't have the access to the account, the client provided me just the FTP so I'm not aware
on this)
3. How to resolve this? Is there a code to make this work?
Anyone can help me? :confused:
You'll probably get a better answer if you post an examplified version of your relevant mail() code. (By examplified I mean: don't go posting your real e-mail or anything else that makes you or the site identifiable, but all relevant code to sending mail should be included.)
Here's my code for the mail() that's uploaded on
Yahoo Small Biz Hosting. BUT i don't receive any email
using this....THO it works fine when this uploaded to
other hosts....
$emailSubject = 'Subject';
$webMaster = 'myemail@www.com';
$NameField = $_POST['Name'];
$EmailField = $_POST['Email'];
$UnitField = $_POST['Unit'];
$PVCField = $_POST['pvc'];
$ExtSAField = $_POST['extsa'];
$RailingsField = $_POST['railings'];
$GlassField = $_POST['glass'];
$ExtPField = $_POST['extp'];
$ExtBTField = $_POST['extbt'];
$GraniteCTField = $_POST['gct'];
$InteriorC1Field = $_POST['ic1'];
$KitchenCLField = $_POST['kcl'];
$InteriorC2Field = $_POST['ic2'];
$GeneralFField = $_POST['gf'];
$StairsField = $_POST['stairs'];
$WoodBField = $_POST['wb'];
$TNBField = $_POST['tnb'];
$DateTime= date("F j, Y, g:i a");
$body = <<<EOD
<b>Name:</b> $NameField<br>
<b>Unit:</b> $UnitField<br>
<b>Date:</b> $DateTime<br><hr><br>
<b>• EXTERIOR</b><br><br>
<b>PVC Frame:</b> $PVCField<br>
<b>Exterior Stone Accent:</b> $ExtSAField<br>
<b>Railings:</b> $RailingsField<br>
<b>Glass:</b> $GlassField<br>
<b>Exterior Paint:</b> $ExtPField<br>
<b>Exterior Balcony Tiles60x60:</b> $ExtBTField<br>
<br><br>
<b>• INTERIOR</b><br><br>
<b>Granite Counter Tops:</b> $GraniteCTField<br>
<b>Interior Colors:</b> $InteriorC1Field<br>
<b>Kitchen Cabinet Laminate:</b> $KitchenCLField<br>
<b>Interior Colors:</b> $InteriorC2Field<br>
<b>General Flooring:</b> $GeneralFField<br>
<b>Stairs:</b> $StairsField<br>
<b>Wood Baseboards:</b> $WoodBField<br>
<b>Toilet and Bath:</b> $TNBField<br>
EOD;
$headers = "From: $EmailField\r\n";
$headers .= "Content-type:text/html\r\n";
if(mail($webMaster,$emailSubject,$body,$headers));
{
header("Location: index.html");
}
if(mail($webMaster,$emailSubject,$body,$headers));
{
header("Location: index.html");
}
Correct:
if(mail($webMaster,$emailSubject,$body,$headers))
{
header("Location: index.html");
}
You might also try this while trouble shooting:
mail($webMaster,$emailSubject,$body,$headers);
header("Location: index.html");
AND
Put up a page called test.php with this on it to see if Yahoo sends mail at all:
<?php mail('youremail@site.com','Subject','Does Yahoo! Send Email?'); ?>
How to resolve the $headers issue?
THIS ONE WORKS BUT ON EMAIL IT HAS HTML tags:
mail('myemail@www.com','Subject',$body);
THIS DOESN'T WORK:
mail('myemail@www.com','Subject',$body, $headers);
I even change it to text/plain, still it doesn't send an email.
I found this: [help.yahoo.com...] but I'm not sure if it will help me solve this issue.
Is there any other way to fix this thru php?
Maybe there's a parameter they're not liking, so try variations of:
$headers = 'Content-type: text/html' . "\n\n" .
'From: yourEmail@yoursite.com' . "\n\n";
$headers = 'MIME-Version: 1.0' . "\n\n" .
'Content-type: text/html' . "\n\n" .
'From: ' . $EmailField . "\n\n";
I really don't know beyond that, because what I gave you is basically what I use, but I have no experience with Yahoo! hosting at all...
I found out that it's the problem
on the Hosting that rejects the 'From' field. Yahoo Host checks if the address belongs to
the website domain (passing a variable on 'From' will reject it,so you must specify a fix email
address) and you can just display the USER's/VISITOR's Email as Reply-To.
The code you gave resolves the issue:
$headers = 'Content-type: text/html; charset=iso-8859-1' . "\n\n" .
'From: yourEmail@yoursite.com' . "\n\n" . 'Reply-To: $EmailField' . "\n\n";
Thanks TheMadScientist!
Hope this will be a help to others. =)