Jump to content

Help with newsletter script


leslie_

Recommended Posts

hey!

ive recently made a newsletter script for my site

every time i send a newsletter it closes the directory because of the 'email limit'

my host said I need to modify the script to send at seperate intervals.

 

How would I go about doing this?

here is my current code..........

 

				if(!$_POST[send_newsletter]){
			?>
			<form method="post">
			<strong>Subject:</strong>
			<br><input type="text" name="subject">
			<Br><Br><Strong>Message:</strong>
			<br><textarea cols="50" rows="10" name="message"></textarea>
			<Br><br><input type="submit" name="send_newsletter" value="Send Now">
			</form>
			<br><br><a href="index.php">« Back</a>
			<?php 
			}else{
			$emailfrom = "[email protected]";
			$message = $_POST[message];
			$subject = htmlspecialchars($_POST[subject]);
			$headers  = "From: $emailfrom\r\n";
			$headers .= "Content-type: text/html\r\n"; 

			$query = "SELECT * FROM `newsletter_emails`";
			$result = mysql_query($query);
			$date = date("jS M Y");
			while($rowdata = mysql_fetch_array($result)){
			$codedEmail = base64_encode($rowdata[email]);
			$emailmessage = <<<EOF
<html>
<body>
<table width="100%" border="0" background="http://www.habboasis.com/images/forum_bg.png" cellspacing="0" cellpadding="5">
<tr>
	<td colspan="3"> <br> <br></td>
</tr>

<tr>
	<td> </td>
	<td width="400px" bgcolor="#6e6e6e">
		<img src="http://habboasis.com/newsletter/images/banner.gif" width="400" height="81" alt="">
	</td>
	<td> </td>
</tr>

<tr>
	<td> </td>
	<td width="400px" padding="5px" background="http://habboasis.com/newsletter/images/datebg.gif" align="right">
		<b>$date</b>
	</td>
	<td> </td>
</tr>

<tr>
	<td> </td>
	<td width="400px" padding="15px" bgcolor="#ededed">
		<b>Dear $rowdata[name],</b>
		<br><br>$message
		<br><br>Love Alwayz,<br>Habboasis Team xox
		<br><br>
		<a target="_blank" href="http://www.habboasis.com/index.php?action=unsubscribe&email=$codedEmail">Click here</a> to unsubscribe.
	</td>
	<td> </td>
</tr>

<tr>
	<td colspan="3"> <br> <br></td>
</tr>
</table>
</body>
</html>
EOF;

			mail($rowdata[email], $subject, $emailmessage, $headers);
			}
			echo("Sent.");
			}

			break;

Link to comment
https://forums.phpfreaks.com/topic/96889-help-with-newsletter-script/
Share on other sites

The only thing I can think of is that they don't like how many emails you are sending at once. You could try creating a table to distinguish whether or not you've mailed to that person and then call your query on the table WHERE you choose 25 people or so that you haven't already sent to. I don't have a clue how many you are sending to, but if it's small, that shouldn't be too bad.

 

You could have it run every time you go to a page so you don't even have to click anything.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.