TIGblogs TIG | TIGblogs TIGBLOGS GRUPALES ENTRAR INSCRíBASE
betzster's Blog
betzster's Blog
Setup a Mailing List

Apparently nobody needs to know how to setup a mailing list anymore. Try checking google, there’s not much to look through, unless you know what your looking for. A client wanted a mailing list, so this is what I found. The IMAP extension for PHP is what you need. Here is the basic script that I found to work:

<?php

$subscribers = “you@gmail.com, sub@scriber.com”;

//Open a POP3 Inbox
$stream = imap_open(”{localhost:110/pop3}INBOX”, “username”, “password”);
//Get the content of the first email
$content = imap_body($stream, 1);

//Send the mail to your subscribers
mail($subscribers, “Subject”, $content, “From: me@mysite.com”);

//Delete the Email so the script is ready for the next time
imap_delete($stream, 1);

?>

You have to setup an email account somewhere, preferably on your webserver, that would be the easiest place to get access, and send an email there. Run this script and it grabs the email and sends it to all of your subscribers and deletes the email so that it’s empty for the next time you send the script.

Now obviously you wouldn’t want to store the list of your subscribers in the script. I’ll end up storing them in a database and pulling all the email addresses out when I call the script.

Remember, this will only work if you have the IMAP extension installed on your server and you have to run this after you send the email so it might be a good idea to setup a cron job to run this at least a couple of times a day, depending on how important the emails are that you are sending out and how time sensitive they are. For a regular mailling list that is sent out weekly or maybe even less frequently than that a couple of times a day should be just fine. If you are going to use this as a listserv, you might want it to run more like once a minute.


June 7, 2008 | 4:06 AM Comentarios  0 comentarios

Etiquetas:
Debes ingresar con tu usuario y cotraseña para agregar etiquetas.


Perfil de Josh


Posteos Recientes
Network Favicons
Set up VirtualBox for...
Facebook Hackathon...
On Comments
WordPress &...

Archivo Mensual
Abril 2007
Mayo 2007
Junio 2007
Julio 2007
Agosto 2007
Septiembre 2007
Octubre 2007
Noviembre 2007
Diciembre 2007
Marzo 2008
Abril 2008
Mayo 2008
Junio 2008
Julio 2008
Septiembre 2008
Octubre 2008
Noviembre 2008
Diciembre 2008
Enero 2009
Febrero 2009
Marzo 2009
Abril 2009
Mayo 2009
Junio 2009
Julio 2009
Agosto 2009
Septiembre 2009
Octubre 2009
Noviembre 2009
Diciembre 2009
Enero 2010
Febrero 2010
Marzo 2010
Abril 2010
Junio 2010
Julio 2010
Agosto 2010
Septiembre 2010
Octubre 2010
Noviembre 2010
Diciembre 2010
Enero 2011
Febrero 2011
Marzo 2011
Abril 2011
Junio 2011
Septiembre 2011
Octubre 2011
Noviembre 2011
Diciembre 2011
Enero 2012

Cambiar idioma


Archivo de Etiquetas
apache apple asides band blog blogs coding design dreamweaver florida gallery general globalwarming hosting johnmayer nifty php plugins politics prom publications school tech themes twitter vacation web windows wordpress youtube

Links
High School Reunion
Josh Betz Blog
Josh Betz Professional
Josh Betz Projects


27645 views