Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-20-2012, 09:51 PM   PM User | #16
KatieK
New Coder

 
Join Date: Sep 2010
Posts: 67
Thanks: 8
Thanked 0 Times in 0 Posts
KatieK is an unknown quantity at this point
We aren't exactly pleased with our hosting company either and will possibly be transferring to a different company.

We know the emails are not sending because we have included our own emails in the mailing list as well as other people we know and have never received any of the emails.

We also started getting the error message 'No recipient addresses found in header', which has never been there before and we haven't altered any of our php code.

Any solutions I've found online for this error message so far aren't applicable as we've already had the recommended fixed code in place.
KatieK is offline   Reply With Quote
Old 04-20-2012, 10:16 PM   PM User | #17
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,748
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Yeah, I think you may need to seek a new host.
All I know for sure, is that the error you have is coming from sendmail. Why its that way I'm not 100% sure. The email would be the most probable cause.
If your host is counting unsent emails, that tells me they have an issue on their end, and are incapable of determining if mail was sent properly. How they would fix it I haven't a clue.
But it doesn't appear to be your PHP code. You could clean it up a bit, remove redundancy in the loop from static strings, and verify emails and whatnots, but all and all it looks like it will run properly.
Fou-Lu is offline   Reply With Quote
Old 04-21-2012, 01:29 AM   PM User | #18
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,667
Thanks: 46
Thanked 456 Times in 444 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by KatieK View Post
We also started getting the error message 'No recipient addresses found in header', which has never been there before and we haven't altered any of our php code.
I've already commented on this. Your hosts php / sendmail configuration has changed. Those blank emails addresses you mentioned earlier were previously not being reported to you but now they are. It's probably always been a problem but because you never saw any error messages you thought it was ok.

Sounds like your host has tinkered with the error reporting settings (and a few others).
__________________
Please don't be rude: Put your php code in [php][/php] tags. It is a sticky topic at the top of the forum and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 04-23-2012, 11:03 PM   PM User | #19
KatieK
New Coder

 
Join Date: Sep 2010
Posts: 67
Thanks: 8
Thanked 0 Times in 0 Posts
KatieK is an unknown quantity at this point
Thanks, it makes sense now why that error started popping up out of nowhere. Problem is even when we change the query to only get the emails that aren't blank none of the emails send. We don't get the 'no recipiants' message anymore but the php mail still isn't working.

It seems like the problem is on our hosting company's end but they aren't cooporating and insist nothing has changed.
KatieK is offline   Reply With Quote
Old 04-23-2012, 11:08 PM   PM User | #20
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,748
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Quote:
Originally Posted by KatieK View Post
Thanks, it makes sense now why that error started popping up out of nowhere. Problem is even when we change the query to only get the emails that aren't blank none of the emails send. We don't get the 'no recipiants' message anymore but the php mail still isn't working.

It seems like the problem is on our hosting company's end but they aren't cooporating and insist nothing has changed.
Don't forget you don't need to actually send email. Log the results to a file instead of mailing to see what's going on, or even print them to the screen.

Yeah, to me it still reeks of the host configurations, and its almost like their not sure what they did to break it.
Fou-Lu is offline   Reply With Quote
Old 04-24-2012, 12:45 AM   PM User | #21
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,667
Thanks: 46
Thanked 456 Times in 444 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Sounds to me like a host operating from a space PC in the basement if you ask me!
__________________
Please don't be rude: Put your php code in [php][/php] tags. It is a sticky topic at the top of the forum and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 04-24-2012, 12:54 AM   PM User | #22
KatieK
New Coder

 
Join Date: Sep 2010
Posts: 67
Thanks: 8
Thanked 0 Times in 0 Posts
KatieK is an unknown quantity at this point
So now we were told we need to specify the relay server in our code for this to work. I have the server address given to us but i'm not sure how to go about adding it. Any ideas?

Our host is godaddy by the way, from hours spent online looking into this it's a common problem people have with them and everyone seems to solve the problem in a different way. Sigh..
KatieK is offline   Reply With Quote
Old 04-24-2012, 01:08 AM   PM User | #23
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,667
Thanks: 46
Thanked 456 Times in 444 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Switch to PHPMailer instead. It's a class that supports not just sendmail but also SMTP relays such as the one your host has specified.
__________________
Please don't be rude: Put your php code in [php][/php] tags. It is a sticky topic at the top of the forum and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 04-24-2012, 02:28 PM   PM User | #24
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,748
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Yeah, phpmailer will use direct sockets to manage the mail I believe.
As for godaddy, yes these have been hit or miss. I've seen half of the posts working with godaddy mail() and the other half not (not just you, user wise).
What they want you to do is pass the information required over to a script that sends. I don't know the fields I'm afraid, but they should have a FAQ with what you can use. You can do it directly by changing your form action to point at their scripts, or you can submit your forms, and use curl to submit it to their forms. For what you have here, you'd need to curl (I'm pretty sure if I recall previous posts on their forms, it is passed by post). I'd suspect that you'll have a full FAQ and tutorial somewhere on their site to guide you through setting this up.
Fou-Lu is offline   Reply With Quote
Old 04-24-2012, 02:41 PM   PM User | #25
bcarl314
Mega-ultimate member


 
Join Date: Jun 2002
Location: Winona, MN - The land of 10,000 lakes
Posts: 1,855
Thanks: 1
Thanked 45 Times in 42 Posts
bcarl314 will become famous soon enough
Have you tried using the optional sendmail flag (-f)?

PHP Code:
$mail mail("someone@example.com","subject","my message","From: mycompany@example.com","-fmycompany@example.com"); 
bcarl314 is offline   Reply With Quote
Old 04-26-2012, 09:46 PM   PM User | #26
KatieK
New Coder

 
Join Date: Sep 2010
Posts: 67
Thanks: 8
Thanked 0 Times in 0 Posts
KatieK is an unknown quantity at this point
After messing around with this for a while I've found some php mail code that works. Can't say I understand why this works and our other code didn't but it's posted below. Thanks all

PHP Code:
mysql_connect("dbserver""dbusername""dbpassword") or die(mysql_error()); 
mysql_select_db("dbname") or die(mysql_error()); 
$result mysql_query("SELECT email FROM email_list WHERE email != '' ") or die(mysql_error());


while (
$row mysql_fetch_array($resultMYSQL_ASSOC)) { 


$email$row['email'];
if(isset(
$_POST['upload'])){
    if(
$goodtogo =="alliswell"){
    
$message "<html><body><center>
<table border='0' bgcolor='#8a6754' width='850'>
<tr><td align='center'><img src='http://website/images/logo.png'></td></tr>
<tr><td align='center'><font color='#ffffff'>The newsletter for website.com has been updated. To view it, <a 
href='http://website.com/newsletter.php'>click here</a><br><br><br>
<em>Adobe Acrobat Reader is needed to view this newsletter. To download this free software click the link below</em><br>
http://get.adobe.com/reader<br><br>
</font></td></tr></center></body></html>"
;

$headers 'MIME-Version: 1.0' "\r\n";
$headers .= 'Content-type:text/html;charset=utf-8' "\r\n";
$headers .= 'From: Name <email@email.com>' "\r\n";
$headers .= 'Return-Path:<email@email.com>' "\r\n"

$mailmail("$email""subject""$message""$headers");
}}}
if (
$mail) {
    echo 
"<font color='#ffffff'><br><br><em>A notification was successfully sent to the mailing list.<br></em></font>";}
else if (!
$mail){ 
echo 
"<font color='#ffffff'><br><em>There was an error, please try again later.</em></font>";}
?> 
KatieK is offline   Reply With Quote
Old 04-26-2012, 11:14 PM   PM User | #27
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,748
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Are you sure? The $mail check only occurs after all the looping is complete, so it will only contain the last result of the mail() call.
Not sure why that may change it. Neither the mime or the return-path are required.
You should look into using the Pear mail package. It's better than using mail if you want to bulk it up.
Fou-Lu is offline   Reply With Quote
Old 04-27-2012, 09:51 PM   PM User | #28
Mike_GoDaddy
New to the CF scene

 
Join Date: Apr 2012
Location: Scottsdale, AZ
Posts: 8
Thanks: 0
Thanked 1 Time in 1 Post
Mike_GoDaddy is an unknown quantity at this point
Quote:
Originally Posted by KatieK View Post
After messing around with this for a while I've found some php mail code that works. Can't say I understand why this works and our other code didn't but it's posted below. Thanks all
If you are still having any issues I would be more than happy to look into this issue if you PM me your account number or domain name.
Mike_GoDaddy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:38 PM.


Advertisement
Log in to turn off these ads.