pietbez Posted March 6, 2008 Share Posted March 6, 2008 i have a database of about 3000 opt in/out members. i send mail to them with a php script, but my smtp mail server allows for only 300 mails per day. is it posible to write into the script that the 1srt 300 emails get sent through one mail server, then the next 300 trhough another domains mail server and so on. obviously one would have to have a few domains to do this. Or could someone please tell me the right way to go about this? i am a bit stuck. this is NOT for sending spam. all legit registered members thanks Quote Link to comment Share on other sites More sharing options...
schilly Posted March 6, 2008 Share Posted March 6, 2008 create gmail, hotmail, yahoo accounts and send through them with authenticated smtp? Quote Link to comment Share on other sites More sharing options...
pietbez Posted March 6, 2008 Author Share Posted March 6, 2008 briliant! never thought of that! how many mails per account/batch can these handle 200? 300? and would the php mailer be able to devide the database up into these batches automaticaly? i know, probably a stupid question?? Quote Link to comment Share on other sites More sharing options...
schilly Posted March 6, 2008 Share Posted March 6, 2008 I'm guessing probably 300 at a time per server. Not too familiar with php mailer but you will prolly have to write to code yourself to break them up into batches of 300. could just do some nested loops. have an multi-d array of the smtp info (ie. Array( Array(smpt server, login, password), ..., etc) ) then $stmp_info = //multi-d array with server info while( $i < array_len($stmp_info)){ $counter = 0; while($row = mysql_get_array($resource)){ //send out email from the email address in the db row based on smtp info at $stmp_info[$i] $counter++; if($counter == 300) break; } $i++; } something like that. it's probably not totally correct and would require some testing but i hope you get the idea. Quote Link to comment Share on other sites More sharing options...
revraz Posted March 6, 2008 Share Posted March 6, 2008 Sounds like it would be so much easier to use something like Coolist instead, where you just email a grouplist and let it handle the emails. Quote Link to comment Share on other sites More sharing options...
pietbez Posted March 6, 2008 Author Share Posted March 6, 2008 Coollist sounds great, but my database is growing on a daily basis. sending directly from the mysql db has the advantages that mailing lists are always updated. Also personal info like name, email, and preferences can be tailored for each member. i also have a mail tracker system to see who has actualy opened their mails by inserting a 1x1pixel gif in the mail. and lastly, i am always nervous to give my database to a third party. i have to respect the privacy of my members that they entrust in me. Schilly, i like your take on it. i think i understand it. now i just have to see if i can write it into my mailer cript as i am a newbie to php. i will give it a good go though. Thanks Quote Link to comment Share on other sites More sharing options...
pietbez Posted March 6, 2008 Author Share Posted March 6, 2008 now i am confused?? does this script use smtp? to send mail? <? include('../functions.php'); if(!$_SESSION['admin_logged_in']) { header('Location: ' .LOGIN_URL ); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Admin | Send mass mail</title> <link href="style.css" rel="stylesheet" type="text/css" media="all" /> <body> <? $letter_id = ( !empty($_REQUEST['letter_id']) ) ? $_REQUEST['letter_id'] : FALSE; $msg=''; $let_info=get_letter($letter_id); $letter_title=$let_info['name']; $hf=get_hf(); if (isset($_REQUEST['submit_preview'])) { $ready_to_send = true; $letter_body=''; $letter_body=$hf['header'].'<br>'.$let_info['content'].'<br>'.$hf['footer'].'<br>'; } if (isset($_REQUEST['submit_mass_mail'])) { $info=get_mass_mails(); $members=$info['items']; $oks=$bads=$invalids=0; $letter_body=''; $headers=''; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: dorp <contact@xxxx.co.uk>'. "\r\n"; $headers .= 'Reply-To: contact@xxxx.co.uk' . "\r\n"; $hf_header_tmp = $hf['header']; $let_info_tmp .= $let_info['content']; for ($i=0; $i<$info['total']; $i++) { $name = $members[$i]['name']; $email = $members[$i]['email']; if (valid_mail($email)) { //$headers .= "To: $name <$email>" . "\r\n"; $hf['header'] = str_replace('[name]', $name, $hf_header_tmp); $hf['footer'] = str_replace("[email]", $email, $hf['footer']); $let_info['content'] = str_replace('[name]', $name, $let_info_tmp); $letter_body =$hf['header'].'<br>'.$let_info['content'].'<br> <img src="http://www.xxxx.co.uk/cpanel/mail.php?id='.$letter_id.'&u='.$members[$i]['id'].'">'.$hf['footer'].'<br>'; $letter_body = str_replace("\n.", "\n..", $letter_body); if (mail($email, $letter_title, $letter_body, $headers)) ++$oks; else ++$bads; } else { ++$invalids; } } $all=$oks+$bads+$invalids; $msg="<br>Mailing reports:<br> <br>Letter: #$letter_id - $letter_title<br> <br>Sent: $oks <br>Failed: $bads<br> <br>Invalid E-mails: $invalids<br> <br>Total: $all ."; create_log_entry($_SESSION['auth_literal_admin_level'].' '.$_SESSION['auth_admin_name'].$msg,$_SESSION['auth_admin_name'],'mailing'); // } ?> <br /> <script language="javascript" type="text/javascript"> function disableForm(theform) { if (document.all || document.getElementById) { for (i = 0; i < theform.length; i++) { var tempobj = theform.elements[i]; if (tempobj.name.toLowerCase() == "submit_mass_mail" || tempobj.type.toLowerCase() == "submit_preview") tempobj.disabled = true; } } } </script> <form id="form1" name="form1" method="post" action="mass_mailer.php?letter_id=<? echo $letter_id; ?>"><!-- onSubmit="return disableForm(this);" --> <table width="685" border="0" align="center" cellpadding="0" cellspacing="1" class="input_form"> <tr> <th colspan="2" scope="row">Send mass mail </th> </tr> <tr> <td colspan="2" class="style7" scope="row"> </td> </tr> <tr> <td width="85" class="style7" scope="row">Choose letter </td> <td width="412"> <select name="letter_id" id="letter_id"> <? $eq = get_letters(); $eq_info = $eq['items']; for ($i=0; $i<$eq['total']; $i++) { if ($eq_info[$i]['id'] == $letter_id) $chx='selected="selected"'; else $chx=''; echo "<option value='{$eq_info[$i]['id']}' $chx>{$eq_info[$i]['name']}</option>\r\n"; } ?> </select> <input name="submit_preview" type="submit" id="submit_preview" value="Preview!" /></td> </tr> <? if ($ready_to_send) {?> <tr> <td colspan="2" scope="row"><span class="style7"> You are about to send a mass mail to <? echo count_members(); ?> members of your site </span></td> </tr> <tr> <td colspan="2" class="header" scope="row"><div align="center"><span class="style7"> </span>** Letter preview below ** <span class="style7"> </span></div> </td> </tr> <tr> <td colspan="2" scope="row"><? echo $letter_title ; ?></td> </tr> <tr> <td colspan="2" scope="row"><? echo $letter_body ; ?></td> </tr> <tr> <td colspan="2" class="header" scope="row"><div align="center"><span class="style7"> </span>** end preview ** <span class="style7"> </span></div></td> </tr> <tr> <td colspan="2" scope="row"><div align="center"> <script language="javascript"> function write_message(letter_id) { alert(letter_id); //document.write('Please be patient while mailing list is processed! This may take a while, depending on the total users...'); } </script> </div></td> </tr> <tr> <td colspan="2" scope="row"> <div align="center"> <input name="submit_mass_mail" type="submit" id="submit_mass_mail" value="Send mass mail!" /> <span class="error"><br />(press only once and wait the page to load completely!)</span></div></td> </tr> <? ;} ?> <tr> <td colspan="2" scope="row"> <div align="left" class="error"> <? if ($msg!='') {echo $msg;} ?> </div> </td> </tr> </table> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
schilly Posted March 6, 2008 Share Posted March 6, 2008 nope uses mail. when you said you were using php mailer i thought you meant PHP Mailer: http://phpmailer.codeworxtech.com/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.