Jump to content

Recommended Posts

Does anyone have a quick mass mail code?

I own and operate a game called War Deities!

 

I had a code that would pull all of the email address fomr a table on my database and allow me to send everyone the same email.

 

It looked like this, but with the actual table/colum names:

 

<html>

<head>

<title></title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

 

</head>

 

<?php

include 'xxx';

?>

<link rel="stylesheet" href="../style.css" type="text/css">

<?php

if (isset($_POST['submit']))

{

 

        $subject = $_REQUEST['subject'];

        $message = $_REQUEST['message'];

       

        $query="SELECT xxx FROM xxx";

        $result=mysql_query($query);

        $num=mysql_num_rows($result);

 

 

        $i=0;

        while ($i < $num)

        {

       

                $email=mysql_result($result,$i,"email");

                       

                mail($email, $subject, $message, "From: War Deities<webmaster@wardeities.com>\nX-Mailer: PHP/" . phpversion());

       

                echo "Email sent to: " . $email . "<br />";

       

                $i++;

                               

        }

}

?>

<br />

 

               

<form name="email" action="<?=$_SERVER['email.php']?>" method="post">

 

Subject

<br />

<input name="subject" type="text" size="50" id="subject"><br /><br />

Message

<br />

<textarea name="message" cols="50" rows="10" id="message"></textarea>

<br /><br />

<input type="submit" name="submit" value="Email!">

       

</body>

</html>

(xxx = information classified to www.wardeities.com)

 

Anyways it was working fine when I only had 100 or less members now that I have over 500 emails from my players on wardeities stored in my database this code crashes every time....it'll send to the first 15-20 then Internet Explorer stops responding!

 

On top of that I really hated this one because I had to sit there with page open as it took about 5 seconds in between each email and posted on screen that it sent it to them...

 

 

Thanks in advance if anyone can help me!

 

 

P.S. I hope I can say this without getting in trouble, but if someone can post a good working one that I can set up to run with a cronjob (I post and email message in the database and have the cronjob pull any existing emails every 24 hours, email them, and mark the sent) I am willing to pay a few dollars for this code via Pay Pal!

 

Thanks Again!!!

 

 

Link to comment
https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/
Share on other sites

I can't find any explanation on how to install it...

 

The download has a file [content]

 

If I open it with dreamweaver I get a message saying:

This file has no code extention and will be opened in Code View

And in the file there is a part that says:

require_once 'PEAR.php';

 

And I suppose to name the file PEAR.php, upload it and go to wardeties.com/xxx/PEAR.php

 

Cuz there is no <?php ?> Tags anywhere in the file I downloaded...

 

Just kinda lost on how to install it.....  ???

Link to comment
https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443233
Share on other sites

This looks a little out of my league....I can't figure out how to install it...i thought it would be something like a .php file that you change the database name, table name, and a few other small features and have it up and running in 5 mins or so...this looks like it is something that yahoo or ebay would use...can't figure it out at all....thanks for trying though    :'(

Link to comment
https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443242
Share on other sites

I am using the following code for at least 600 users in my db:

$sql = mysql_query("SELECT nmemail FROM m_user where cdcat=3");
$result=mysql_num_rows($sql);
while ($row = mysql_fetch_array($sql)) {
//********************************************************************************************
if (isset($_POST['btnsave_x'])) {
$msg =($_POST['message']);
$subject =htmlentities($_POST['subject']);
$headers = 'From:A Team <support@something.com>' . "\r\n" .
'Cc: email@yahoo.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion() ."\r\n".
'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message = "

<b>Dear valued subscriber,</b><br><br>
    ".$msg."

<br><br>

For further information please contact:<br>

support@something.com<br>

Best regards,<br>

A Team.

";
$mail=mail($row['nmemail'],$subject,$message,$headers);
header("Location:message1.php");
}
}

 

And its working fine.

Hopefully it will give some idea.

Link to comment
https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443250
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.