Jump to content

Send mass e-mails on certain date


biggieuk

Recommended Posts

Hi all,

 

I have a mysql database with a list of users including their e-mail address.

 

I need to be able to automatically send a mass php generated e-mail upon a pre-determined date. Is this possible?

 

Or would it be easier for the admin to login to the admin area and click send on the actual date that the emails are to be sent?

 

thanks.

 

 

Link to comment
Share on other sites

thanks for your reply.

 

I have another related question.

 

There are a number of email addresses stored in a database. I need to be able to click a button on my website and an e-mail is sent to each person.

 

Is this possible and what would be the best method?

 

Thanks again.

Link to comment
Share on other sites

You can do something like this to send an e-mail to everyone:

<?php

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");


$content=$_POST['content']
$subject=$_POST['subject']
//content and subject of e-mail posted from form
$sql = "SELECT * FROM Members";
$result=mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$address = $row[email];
$name=$row[firstName] ." ". $row[lastName];

  //send email
$emess= "<html>
$content
</html>";

$headers= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From:xxxx@php.com';


$mailsnd=mail("$address","$subject","$emess","$headers");

echo "Email send to $name at $address.<br />";
}

 

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.