Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature currently requires accessing the site using the built-in Safari browser.
<?php
// Configuration settings for This Site
// Email Settings
$site['from_name'] = '[COLOR="Blue"]James Bond[/COLOR]'; // from email name
$site['from_email'] = 'J[COLOR="Blue"][email protected][/COLOR]'; // from email address
// Just in case we need to relay to a different server,
// provide an option to use external mail server.
$site['smtp_mode'] = 'enabled'; // enabled or disabled
$site['smtp_host'] = '[COLOR="Blue"]mail.yoursite.com[/COLOR]';
$site['smtp_port'] = '25';
$site['smtp_username'] = '[COLOR="Blue"][email protected][/COLOR]';
$site['smtp_password'] = '[COLOR="Blue"]emailpassword[/COLOR]';
?>
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/PHPMail/class.phpmailer.php');
class ZapMailer extends PHPMailer
{
var $priority = 3;
var $to_name;
var $to_email;
var $From = null;
var $FromName = null;
var $Sender = null;
functspamapMailer()
{
global $site;
// Comes from MainSite.php $site array
if($site['smtp_mode'] == 'enabled')
{
$this->Host = $site['smtp_host'];
$this->Port = $site['smtp_port'];
if($site['smtp_username'] != '')
{
$this->SMTPAuth = true;
$this->Username = $site['smtp_username'];
$this->Password = $site['smtp_password'];
}
$this->Mailer = "smtp";
}
if(!$this->From)
{
$this->From = $site['from_email'];
}
if(!$this->FromName)
{
$this-> FromName = $site['from_name'];
}
if(!$this->Sender)
{
$this->Sender = $site['from_email'];
}
$this->Priority = $this->priority;
}
}
?>
<FORM name="EMForm" method="post" action="PHPActionScriptBelow.php">
<H2 align="center"><B><FONT face="Tahoma, Arial">WaMu Equity Alert</FONT></B></H2>
<P><B>This message will be sent to all who have a blank IP address.</B></P>
<P>
<TEXTAREA name="FrmText" rows="10" cols="80"></TEXTAREA>
</P>
<P> </P>
<INPUT type="submit" name="Submit" value="Submit">
<P> </P>
</FORM>
<?php
include "[COLOR="Blue"]databaseconnectionparametersForYour site.[/COLOR]php";
// Grab our config settings
require_once($_SERVER['DOCUMENT_ROOT'].'/MainSite.php');
// Grab the Mailer class
require_once($_SERVER['DOCUMENT_ROOT'].'/MailExtend.inc');
// instantiate the class
$mailer = new ZapMailer();
// This field is from the form.
// [COLOR="Blue"]You'll have to modify this code for your application[/COLOR]
$PostFrmText = $_POST["FrmText"];
$StripSlash = stripslashes($PostFrmText);
$SendMessage = wordwrap($StripSlash, 70);
// Subject could be posted in form and passed to the script if you want.
$mailer->Subject = "This is the subject of the Email";
$mailer->Body = $SendMessage;
$HoldQuery = "SELECT * FROM Holders";
$HoldResult = mysql_query($HoldQuery) or Print "No Such Query";
$HoldRow = mysql_fetch_array($HoldResult);
$SendCount = 0;
$LoopCount = 0;
// This loops through the database and adds each email via BCC to the main email. Then when it gets them all, it
// sends just one email. I've only got 400 people in this database, so if you have a lot
// of emails, you might want to send them separately, I don't know.
while ($HoldRow) {
$LoopCount++;
// SMA if something goes wrong. You might want to do this until bugs are gone.
if ($LoopCount > 500) die("Too many - $LoopCount");
if ($HoldRow["[COLOR="Blue"]SomeField[/COLOR]"] == "[COLOR="Blue"]WantsEmail[/COLOR]") {
$SendTo = $HoldRow["[COLOR="Blue"]EmailField[/COLOR]"];
echo "Sent To: " . $SendTo . "<BR>";
$mailer->AddBCC("$SendTo");
$SendCount++;
}
$HoldRow = mysql_fetch_array($HoldResult);
}
if(!$mailer->Send()) {
echo "There was a problem sending this mail!";
}
else
{
echo "Mail sent!";
}
?><P><?php
echo "Number Sent T1: " . $SendCount;
?>
while ($HoldRow) {
$LoopCount++;
if ($LoopCount > 500) die("Too many - $LoopCount");
if ($HoldRow["HEMail"] != "") {
$SendTo = $HoldRow["HEMail"];
echo "Sent To: " . $SendTo . "<BR>";
$mailer->AddBCC("$SendTo");
$BatchCount++;
$SendCount++;
}
if ($BatchCount > 48) {
if(!$mailer->Send()) {
echo "There was a problem sending this mail!";
}
else
{
echo "Mail sent!";
}
$BatchCount = 0;
$mailer->ClearBCCs();
}
$HoldRow = mysql_fetch_array($HoldResult);
}
?><BR><?php
if(!$mailer->Send()) {
echo "There was a problem sending this mail!";
}
else
{
echo "Mail sent!";
}