How can i send 10000 emails???

Discussion in 'PHP' started by abdostar, Apr 20, 2008.

  1. #1
    can any one please help me to send about 10000 email for my newsletter, I'm completly dumb in that part of coding and emailing,
    can i use gmail send those emails?and how can i do it fast and not get marked as spam?
    please i need your help
     
    abdostar, Apr 20, 2008 IP
  2. asmina22

    asmina22 Active Member

    Messages:
    726
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    60
    #2
    i can help , pm me with your details and pricing
     
    asmina22, Apr 20, 2008 IP
  3. hormoz

    hormoz Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you need a powerful server with no anti-spam on it

    usually a deticated one
     
    hormoz, Apr 20, 2008 IP
  4. Syndicated Content

    Syndicated Content Banned

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yeah, it is not about coding but hosting services and most of them will suspend your account if you send a large number of emails even if legit, i.e. opt-in newsletters.

    Send emails through Gmail is just the same as they have anti-spam filters that even put on-hold white lists.

    There are shareware and freeware programs to send large number of emails (mostly available at download.com) however they require your ISP settings and nowadays most ISPs have blocked port 25 to avoid massive sending.
     
    Syndicated Content, Apr 20, 2008 IP
  5. Xtrm2Matt

    Xtrm2Matt Active Member

    Messages:
    129
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Place all emails in a text file called 'emails.txt', then create this file:

    <?php 
    	// Email List
    	$filename = "emails.txt";
    	
    	// Subject
    	$subject = "Email Subject";
    	
    	// Content
    	$content = "Line 1<br />";
    	$content .= "Line 2!";
    	
    	// Headers
    	$headers = "Content-Type: text/html\n";
    	$headers .= "From: yourname.com\r\n";
    	$headers .= "Reply-To: you@domain.com\r\n";
    		
    	$lines = file( $filename ); 
    	foreach( $lines as $line )
    	{ 
    		set_time_limit( 25 );
    		$line = rtrim( $line );
    		mail( $line, $subject, $content, $headers );  
    	}
    
    	// All done!
    	echo( "Sent all emails!" );
    ?>
    PHP:
    Unless you own your own hosting / server, then you may have problems using my script.
     
    Xtrm2Matt, Apr 20, 2008 IP
  6. Student Gamers

    Student Gamers Banned

    Messages:
    47
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    To ease strain on your server you could set up a cron job that will work through a database of emails and work through maybe a chunk of 50 at a time every 5 minutes.

    <?php
    $getEmails = mysql_query("SELECT ..... WHERE `sent` = '0' LIMIT 50");
    while($email = mysql_fetch_assoc($getEmails))
    {
        ## Made up function to save space in example
        mail_it($email['userEmail']);
    
        mysql_query("UPDATE ..... SET `sent` = '1' WHERE `id` = '".$email['id']."' LIMIT 1");
    }
    ?>
    PHP:
    If you echo any text you will recieve an email saying what it says. So you could add...

    echo 'This batch was sent successfully';
    PHP:
    If you wanted to know.
     
    Student Gamers, Apr 20, 2008 IP
  7. phpl33t

    phpl33t Banned

    Messages:
    456
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Here is an example of what I do, using PHPMAILER. YOu see, the mail() function is not good because if your sendmail is not configured correctly, then the emails will get blocked by AOL and others that are paranoid against spam. Also, you need a dedicated server. But, if they are not opt-in/opt-out then you may get blacklisted. If they are members that joined your sebsite,t hen it is not spam, they opted in my registering.

    
    		require('class.phpmailer.php');
    		require('class.pop3.php');
    		// SMTP AUTH CONFIG
    		$smtphost = 'mail.domain.com';			// smtp host
    		$smtpfromname = 'domain.com Auto Mailer';	// name the email comes from (ie; admin, jeff, webmaster, YourSite.Com NoReply)
    		$smtpfromaddress = 'noreply@domain.com'; 	// email account to relay the mail through
    		$smtpfrompassword = 'PASSWORD'; 		// password for the above email account
          		if (isset($_POST['body']) && !empty($_POST['body'])) {
          			$msg = $_POST['body'];
          		} else {
          			echo Message("<div>Blank messages not allowed. <a href=\"massmail.php\">Go back...</a></div>");
    	      		include("./system/exit.php");
          		}
          		if (isset($_POST['subj']) && !empty($_POST['subj'])) {
          			$subj = $_POST['subj'];
          		} else {
          			echo Message("<div>Blank subjects not allowed. <a href=\"massmail.php\">Go back...</a></div>");
    	      		include("./system/exit.php");
          		}
          		$sql = mysql_query('SELECT `username`,`email` FROM `Users` WHERE `email` != "" OR  `email` != " "') or die(mysql_error());
          		if (mysql_num_rows($sql) != 0) {
          			while ($items = mysql_fetch_array($sql)) {
          				$username 	 = stripslashes($items['username']);
          				$email    	 = stripslashes($items['email']);
    				$mail    	 = new PHPMailer();
    				$mail->IsHTML(false);
    				$body    	 = $msg;
    				$mail->From      = $smtpfromaddress ;
    				$mail->FromName  = $smtpfromname;
    				$mail->Subject   = $subject;
    				$mail->AltBody   = str_replace('<br>','\n\r',$body);
    				$mail->AltBody   = str_replace('<br />','\n\r',$AltBody);
    				$mail->AltBody   = strip_tags($AltBody);
    				$mail->MsgHTML($body);
    				$mail->AddAddress($email, $username);
    				if(!$mail->Send()) {
    					echo Message("Failed to send mail");
    					include("./system/exit.php");
    				} else {
    					echo Message("Mail sent <br /> <br />");
    				}
          			}
          			echo Message("<div>All emails sent! <a href=\"massmail.php\">Go back...</a></div>");
    	      		include("./system/exit.php");
          		} else {
          			echo Message("<div>There are no users in the database. <a href=\"massmail.php\">Go back...</a></div>");
    	      		include("./system/exit.php");
          		}
    PHP:
    Dont mind include("./system/exit.php");, that is for my templating system. I hope this example helps.
     
    phpl33t, Apr 20, 2008 IP
  8. FUNNYBIRD

    FUNNYBIRD Peon

    Messages:
    76
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    try WorldCast
     
    FUNNYBIRD, Apr 21, 2008 IP
  9. hip_hop_x

    hip_hop_x Active Member

    Messages:
    522
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #9
    i saw some examlples, i'll write my example too... just in case.
    for($i=1;$i<=1000;$i++){
    mail_function(); //replace with mail, more info here: http://www.php.net/manual/en/function.mail.php
    }
    
    PHP:
    The timeout should be higher than 60 secs i belive, because script might flood.
     
    hip_hop_x, Apr 21, 2008 IP
  10. fastdomains

    fastdomains Active Member

    Messages:
    409
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #10
    phpl33t do you use zend studio or writed yourself ?
     
    fastdomains, Apr 21, 2008 IP
  11. tarun

    tarun Active Member

    Messages:
    219
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #11
    i like to use WorldCast
     
    tarun, Apr 22, 2008 IP
  12. zackucom

    zackucom Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Most Internet Service Provider were blocked Port 25 in order to combat spam activities and this action cause user could not send out mass mail to their recipient. Even you to try use a good mailing software, your email will not delivered.

    I have a solution for this issue. I already found one hosting company that allow you to use their SMTP Server to send email in large quantity and unlimited mailing in one day. The requirement is you must buy domain and hosting with them and I will install FREE Autoresponder Script and you can start promote your product immediately.

    Interested to know further, feel free to contact at zackucom [at] gma.il do t co m.
     
    zackucom, Aug 25, 2009 IP
  13. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #13
    On major problem with some of the suggestions above. Any attempt to send that amount of emails all at once and that many mail requests without a delay in between each send is easily met with banning from your hosting provider or your email provider (if thru SMTP), as per most service rules you have to delay the time between batches of emails by least 30 seconds to a minute, otherwise you're immediately flagged as a spammer.
     
    kblessinggr, Aug 25, 2009 IP
  14. a53mp

    a53mp Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    If you are a serious company or website dealing with that many emails, you really should look into a hosted solution. Any mistake can blacklist your server, or you can even get crap from your hosting company.. but unless you really have a good server with proper configurations chances are you probably aren't going to get the best results..

    but if you do want to do it yourself, your best bet as mentioned already would be to use something like phpmailer, set to send emails periodically with cron, instead of a huge blast all at once.
     
    a53mp, Aug 25, 2009 IP