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 <info@myweb.com>";
$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
}


?>

Link to comment
Share on other sites

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!

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.