weekly notification letter help

I have this code at the moment

[php]<?php
include “storescripts/connect_to_mysql.php”;
$rs = mysql_query(‘SELECT email from user LIMIT 0, 10’);

while(list($email) = mysql_fetch_row($rs))
{
// Send Email
mail($email, ‘Notification Letter’, ‘I will fill this in later’);
}
?>[/php]

I want to know 2 things:

1- I need to go on the page to send it but I want it to be sent every week on Monday so I don’t have to access that page again.

2- I want to change the email it’s being sent from (no idea how to do that)

thank you

q1 - CRON job
q2 -
[php]

<?php include "storescripts/connect_to_mysql.php"; $rs = mysql_query('SELECT email from user LIMIT 0, 10'); // set your headers $headers = "From: " . strip_tags($_POST['req-email']) . "\r\n"; // change your FROM here $headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n"; // not required, but nice to have $headers .= "MIME-Version: 1.0\r\n"; // these last 2 are needed if you're sending html in the email $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; while($r = mysql_fetch_array($rs)) { // Send Email mail($r['email'], 'Notification Letter', 'I will fill this in later', $headers); } ?>[/php]

thankyou for replying

but I have no idea what a cron job is

can you help me with that please

cron is a program that you can set to run something at a designated time and date.

here is a link to cron: http://www.unixgeeks.org/security/newbie/unix/cron-1.html

Your other option is windows task scheduler, assuming you are running a windows machine, you can set your homepage on the browser to that page, and have task scheduler open the browser on monday(easy way). Or you can code in the url that you want to open in the broswer to run at that time and date.

Also, you mentioned changing the return address or the “from” address.
Do you mean you want to change who the message returns to or you really want to put
someone else’s address as the return address? Remember, that some changes in return address
may be considered as SPAM! But, to do this, you would have to have the from-address saved in
your database or wherever and then load it into a variable and use it in your email.

I would use the CRON job as suggested by Richei and perhaps give us a little more info on what
you really want to do. I am sure it can be done. The CRON job is just a command that tells a page
or program to run on your server. If you have your own server there are many ways to do it.
But, going by the include you showed, most likely it is someone else’s server. There are other ways
to do this. You can use your user’s input to trigger the email so it is automated. But, it depends on
what you are attempting to do. So, if you don’t get it, let us know more of the details… Good luck!

Sponsor our Newsletter | Privacy Policy | Terms of Service