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