Jump to content

why this "send db-records to email" script doesnt work?


mac007

Recommended Posts

Hello, all:

 

I am trying to get this script to work... I did get it to work at some point but then got my code shuffled and now cant get it back... Anyways, what I'm trying to do is to be able to email back customers whose emails  I have saved on in my database. So pretty much the emails get sent as it runs the "while" loop. Somehow it doesnt seem to be doing it though...

 

What am I missing??

 

Thanks!

 

 


<?php

$connection = mysql_pconnect('hostserver','user','password') or die('Connection not found!');   
$db = mysql_select_db('database', $connection) or die('Database not found!'); 


$emails = mysql_query("SELECT DISTINCT offer_email FROM customer_emails ORDER BY dateEntry DESC");

while ($row_emails = mysql_fetch_array($emails))
{

$to = $row_emails['offer_email'];
$subject = "Website Info";
$message = "hello message\n\n";
$from = "From: Website <[email protected]>";
$header = "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
$header .= $from; // set the from field in the header
$header .= "\n"; // add a line feed
mail($to, $subject, $message, $header); // send the e-mail
}


?>

hello, all:

 

well, I guess the script DOES work!! I placed the code in another site, ran it from there, and ditto.. it worked just fine. after all I had ran it severasl times, it was working just fine, and then all of a sudden it didnt...

 

I guess must be that my email host-server might have been stopping my testing cause it might have been seen as SPAM?? is that possible?

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

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