Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Send auto email message help
Old 07-09-2005, 04:10 PM Send auto email message help
Junior Talker

Posts: 2
Trades: 0
Please help me. I have been trying to get this script to:

1. Scan my MySQL table with 4 email fields

2. Send html message to email 1 at a time (to be be regarded as spam)

3. Loop back to the top when reach the last email and start over every 2 weeks

4. schedule to run at night around 2, 3am.

5. Include one image at the top and a couple at the bottom.

please help. Here's what I have so far.

$headers = 'From: email@example.com' . "\r\n" .
'Reply-To: email@example.com' . "\r\n" .
'X-Mailer: php/' . phpversion();

mysql_select_db($database_authenticate, $authenticate);

$result = mysql_query("SELECT email1, email2,email3,email4, FROM users WHERE sub = $sub");

if(mysql_num_rows($result) > 0)
{
$count = 0;
while ($row = mysql_fetch_array ($result, mysql_ASSOC))
{

$to = $row['email1'] . ', ';
$to = $row['email2'] . ', ';
$to = $row['email3'] . ', ';
$to .= $row['email4'];
mail($to, $subject, $message, $headers);
$count++;
}
echo "myResult=$count Emails Sent.";
}
else
{
echo "myResult=Email Submissions Failed.";
}
mathieu67 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-09-2005, 08:56 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
Firstly, you mentioned that you're sending spam... spam is evil, and the people that send spam deserve to go to jail for violating the 1988 Data Protection Act.

But anyway, here's a few things to think about. PHP can't schedule itself to execute on a certain date, as PHP is a called upon script (it will only execute when you, or the server, executes it) so for this reason you need to use Cron Jobs to get the server to execute the script and email you the results. http://www.webmaster-talk.com/showthread.php?t=32191

Also, if you're sending mass emails i take it you're using the mail() function in PHP, be warned this can cause massive time out and some emails may not be sent and your service provider may bust you for trying to send mass emails out - so you'll need to look into sockets so that you can keep one open long enough for the script to execute fully.

And the image thing, it's simple HTML if you're not going to attach it to the email - and if you are going to attach it to the email it wont make it past most people SpamWare.
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Send auto email message help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10983 seconds with 12 queries