I need a .php script that will query the database and send email to selected users. I would like the script to only send email to 10 users at a time or write code so script will not fail when trying to send emails to 100 users. There are 100 total emails to be sent. When user click link within email they will be automatically logged into system, system requires email address and pin to login. It will need to be attached to URL. Most of the code is completed below, I don't have time to finish.
MYSQL database
See code below for basic idea of what is needed.
1. Select users from database: first name, last name, email address, user id (pin). from AVC where crt ="c3"
2. Add HTML Content for email
3. HTML Content:
-Subject Title
-URL with email and userid(pin) attached to URL for single click login
-Body Content
-email address
-pin
See code below for example.
<?
// send to each user in confirmed
require_once ('../[login to view URL]');
$query= "SELECT email, firstname, lastname, userid FROM AVC WHERE crt='c3'";
$result = mysql_query ($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$email=$row['email'];//user email
$fn = $row['firstname'];//user first name
$ln = $row['lastname'];//user last name
$pin = $row['userid'];//user ID used as pin
$toe = $email;// to this email
$subject = "You have mail"; //enter subject here
$headers = "From: \n";//from variable
$headers .= "Reply-To: \r\n";//reply variable
$headers .= "MIME-Version: 1.0\r\n";//mime header
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";//html charset
$body = 'Text for email to be here
[login to view URL]'.$fn.'&ln='.$ln.'&pin='.$pin.'&e='.$e;//enter body here HTML is enabled in this email
$return_path = ""; //for return path parameter
$param = "-f" . $return_path; //return path parameter for alternate header
//mail ($toe,$subject,$body, $headers, $param);
if (mail ($toe,$subject,$body, $headers, $param)) {
echo "<p>Message successfully sent to ".$email."</p>";
} else {
echo "<p>Message delivery failed to ".$email."</p>";
}
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[login to view URL]">
<html xmlns="[login to view URL]">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
First Name Last Name
Text goes here for email
URL with variables for single click login
Output pin from database (pin = userid from database)
</body>
</html>
I have 3 year experience in development . I work on PHP , MySql, Joomla, And framework like codeigniter etc. I have also work on adobe flex framework. If you give me the chance , i will deliver you the best results. So we will make long term relationship in business. Thanks, Gurinder
Hello sir
i can do it now..
i am web programmer.. i am working in php, mysql, javascript.. for long time..
i can 110% give you work as you want.
Please message me.
Thanks