Hello PHP gurus, i need to have gmail bulk mail send script.i am newbie on this area.try to educate myself on php forum but it is so complex subject for me. i am open to any thirdparty solution or paid custom script or just fee info thanks a lot
I use the SWIFT php mailing library for email sending. If used in a loop, you can handle mass (bulk) email sending easily. It's very simple to configure, well explained, you don't need much php knowledge to get it work. Here's my example : require_once "_swift/lib/swift_required.php"; // include the library file into your script $transport = Swift_SmtpTransport::newInstance('localhost', 25) ->setUsername('your_username_at_your_server') ->setPassword('your_password') ; $mailer = Swift_Mailer::newInstance($transport); while ($subscribers_row = mysql_fetch_array($result)) { // select all the recipients in this loop $sBody_newsletter = "<html> <head> <title>".$email_subject."</title> <body> <strong>Dear ".$subscribers_row['full_name']."</strong><br /> ".$html_msg." <br /> <hr /> <center> To unsubscribe click this link :<br /> <a href='unsubscribe_link_here'>Unsubscribe now!</a> </center> </body> </head> </html>"; //Create the message $message = Swift_Message::newInstance() //Give the message a subject ->setSubject($email_subject) //Set the From address with an associative array ->setFrom(array('noreply@your_domain.com' => 'From NAME')) //Set the To addresses with an associative array ->setTo(array($subscribers_row['email'] => $subscribers_row['full_name'])) //Give it a body ->setBody($sBody_newsletter, 'text/html') //And optionally an alternative body //->addPart('<q>Here is the message itself</q>', 'text/html') //Optionally add any attachments //->attach(Swift_Attachment::fromPath('my-document.pdf')) ; if ($mailer->send($message)) { echo "<br />Message delivered to : <b>".$subscribers_row['email']."</b>"; } else { echo "Swift error occured..."; } } PHP: Depending on your hosting plan, you can send hundreds of emails easily with this library. I use it to send newsletters to all subscribed users at my site.
Yes, but you'll have to configure an external mail server cause I think you can't use your local host to send emails...
Yes they can, but You'll have to change some things in your php.ini (you'll have to search for it, the location depends on the version of your webserver i.e c:\Xampp\apache\bin\php.ini). Open the php.ini with a text editor (notepad should be fine), locate the lines [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 Code (markup): and change localhost to the SMTP server name of your ISP. Restart the Apache server and try the PHP mail() function.
thanks for advice dujmovicv but , i dont wanna use external smtp server.is there any internal smtp server i can use ?
Not known to me.... I'm afraid you can't solve your issue without a working account and SMTP server of your ISP. However I think the Google mail server might work too.... I haven't tested this but would be nice to see if it's work : [sendmail] ; you must change mail.mydomain.com to your smtp server, ; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup) ; emails delivered via IIS's pickup directory cause sendmail to ; run quicker, but you won't get error messages back to the calling ; application. smtp_server=[COLOR=Blue][B]smtp.gmail.com[/B][/COLOR] ; smtp port (normally 25) smtp_port=[COLOR=Blue][B]587[/B][/COLOR] ; the default domain for this server will be read from the registry ; this will be appended to email addresses when one isn't provided ; if you want to override the value in the registry, uncomment and modify default_domain=[COLOR=Red][B]domain.com [/B][/COLOR] Code (markup):
yes but gmail has restrictions to send bulk email. so need to rotate smtp server,if i need to use this kind of method.
That's true. How many emails and how frequent do you want to send? If you have the money and don't want to use third-party services (like aweber, mailchimp, etc) you can go for a dedicated or VPS hosting plan and use your own script to send bulk email... other than that, I think I'm out of ideas...
thanks a lot . but i still believe that i can send email by using internal smtp server on my local host pc
Your Gmail account won't last a week Why not buy a cheap VPS, there are some cheap ones as low as $2 a month.
Yes, take a look at a site lowendbox.com, I've just seen a $13/Year 128MB OpenVZ VPS. Chances are a lot of these providers won't exist in 24 months time offering VPS's for so little but who cares for $2/month?