Forum Moderators: coopster

Message Too Old, No Replies

mail() not sending emails thru Yahoo Small Biz Hosting

         

sircheel

7:54 am on Oct 15, 2009 (gmt 0)

10+ Year Member



Hello everyone!

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:

TheMadScientist

8:31 am on Oct 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don't have a clue on Yahoo! hosting, and there's really no way for anyone to tell if it's your php or Yahoo! unless they know Yahoo! from personal experience, for some odd reason doesn't allow you to send e-mail...

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.)

sircheel

8:50 am on Oct 15, 2009 (gmt 0)

10+ Year Member



Thanks for reading my post TheMadScientist.

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>&bull; EXTERIOR</b><br><br>
<b>PVC Frame:</b>&nbsp;$PVCField<br>
<b>Exterior Stone Accent:</b>&nbsp;$ExtSAField<br>
<b>Railings:</b>&nbsp;$RailingsField<br>
<b>Glass:</b>&nbsp;$GlassField<br>
<b>Exterior Paint:</b>&nbsp;$ExtPField<br>
<b>Exterior Balcony Tiles60x60:</b>&nbsp;$ExtBTField<br>
<br><br>
<b>&bull; INTERIOR</b><br><br>
<b>Granite Counter Tops:</b>&nbsp;$GraniteCTField<br>
<b>Interior Colors:</b>&nbsp;$InteriorC1Field<br>
<b>Kitchen Cabinet Laminate:</b>&nbsp;$KitchenCLField<br>
<b>Interior Colors:</b>&nbsp;$InteriorC2Field<br>
<b>General Flooring:</b>&nbsp;$GeneralFField<br>
<b>Stairs:</b>&nbsp;$StairsField<br>
<b>Wood Baseboards:</b>&nbsp;$WoodBField<br>
<b>Toilet and Bath:</b>&nbsp;$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");
}

TheMadScientist

9:20 am on Oct 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Seems odd it works anywhere with that extra ; at the end of the if...

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?'); ?>

sircheel

10:06 am on Oct 15, 2009 (gmt 0)

10+ Year Member



Oh shoot thanks! it worked when I omitted the variable $headers. But
it sent me the output on my email with the HTML tags...

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);

TheMadScientist

10:51 am on Oct 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try this instead:

$headers = 'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
'From: ' . $EmailField . "\r\n" .
'Reply-To: ' . $EmailField . "\r\n";

Glad you got it 'almost working'!

sircheel

5:31 am on Oct 16, 2009 (gmt 0)

10+ Year Member



I've tried that and seems Yahoo Small Biz Hosting does not recognize it.

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?

TheMadScientist

1:25 am on Oct 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sorry about being so long in getting back to you & I'm not sure if you got it resolved, but it looks like you can set the e-mail to be html according to the example they give on the Yahoo! website...

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...

sircheel

7:55 am on Oct 19, 2009 (gmt 0)

10+ Year Member



NP, I just read your reply and it helped me tests some header
variations and I was able to jump into conclusions.

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. =)