Jump to content

Server sent emails, now it will not. Nothing changed... help?


Jax2

Recommended Posts

Hi everyone. I'm trying to help a client set up an email cronjob to send out emails telling his employees they need to contact a  certain company each day, depending on the contact date.

 

I wrote my script, tested it the first time and found out I had an error, and for each of the 18 contacts that had to be sent out today, I sent 18 of them... for a total of 324 emails.

 

Oops.

 

I corrected the error and tried it again and this time it sent me all 18 contacts just as it should.

 

I tried it a third time and now it won't send anything at all, or at least, I'm not getting anything.

 

I have tried removing the mail() function and simply echoing each thing onto the page, and I'm getting all the correct data ... (As in, $to, $subject, $body, $headers) ... they show up perfect, but if I try and mail them again, no emails are being sent.

 

Here is the script. Some fast help would be appreciated!

 

<?php
include("includes/db.php");
$today=date('Y-m-d');
$from="XXXX@XXXXX.XXX";
$to="XXXX@XXXXX.XXX";
$subject="Contact call backs for ".$today."";
$headers = 'From: '.$from.'' . "\r\n" .
    'Reply-To: '.$from.'' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

$sql="SELECT * FROM prospects WHERE contact_next='$today'";
$result=mysql_query($sql, $db);
$total=mysql_num_rows($result);
if ($total<1)
{
die();
}
ELSE
{
while ($row=mysql_fetch_array($result))
	{
$body="
".$row['representative'].",\r\n
The following company is scheduled for a call-back today, ".$today.".\r\n
Company: ".$row['company_name']."\r\n
Name: ".$row['firstname']." ".$row['lastname']."\r\n
Address: ".$row['address']."\r\n
City: ".$row['city'].", ".$row['province']."\r\n
Phone: ".$row['phone']."\r\n
Email: ".$row['email']."";

mail($to, $subject, $body, $headers);
	}
}
?>

 

Again, if I remove mail( and simply echo $to, $subject, $body, $headers, they all show up as correct. So, they SHOULD be getting sent out.

 

Link to comment
Share on other sites

I found the problem ... apparently dreamhost, in their infinite wisdom, deemed it necessary to prevent anyone from sending out more than 100 emails in an hour.

 

Therefore, the first 324 I tried to send threw me over the hourly limit, and even though I was only trying to send 18 each time after, I was already suspended for the hour.

 

What a pile of junk. Hope I never need to send out newsletters to more than 100 people at a time :/

Link to comment
Share on other sites

Is the script running on your own computer, or is it a webhost, or dedicated server?

 

The reason I ask is because the webhost could have changed the PHP mail settings, or even blocked your account from sending mail due to the 300+ in one go error.

 

You were right, of course. Thanks! If I hadn't contacted my host to bitch at them already, that would have helped a lot :P

Link to comment
Share on other sites

Is the script running on your own computer, or is it a webhost, or dedicated server?

 

The reason I ask is because the webhost could have changed the PHP mail settings, or even blocked your account from sending mail due to the 300+ in one go error.

 

You were right, of course. Thanks! If I hadn't contacted my host to bitch at them already, that would have helped a lot :P

 

Nice one, glad you solved it. :D

Link to comment
Share on other sites

I'm glad you solved it! I had the issue awhile back I started a directory on a site which automatically sent out email once the links were approved. I didn't check with my host and after I accepted 500 links at one time my host closed my account for violation of policies.  :'(

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.