Boy! aren't you glad another Mailing list/Newsletter Script is going to be written.
That's why I love programming sooo much... so many scripts, written so many ways, so many times... ahhh.. customization!

I've scanned many other scripts, articles, tutorials, the php Manual (😃), and ofcouse this forum (🙂) <--- that's my disclaimier - hopefully so I don't get any slandering going on here. Knowing me, I'll end up head first in it anyway.

Sooo...

I'm trying to write a Mailing list Script or Class (if needed) so that I can hook up some of my client's with a reliable, free-from-being-confused-as-ungodly-SPAM, simple, Mailing List Script. (also, I hope to answer this forum could be a resource to someone else trying to accomplish the same thing.)

As I've scanned many resources I have found many common problems and concerns WITH solutions, but I am having trouble finding CLEAR answers (+ i'd just like to see more- for credibility & efficiency). There may also be many others that I don't propose, so maybe you all could help with that also.

  • your code snipits would be great if you've found a nifty solution.

  • links are very welcome.
    ------------------------------------------------------------------------------

  • How should I prevent the mail as being labeled as SPAM or BULK mail? (the main reason for this thread- cause the script from my host... stinks!)

  • What are the different content-types for the PHP mail() function? and im sure they have an effect on the mail.

  • Will not sending mass email's hold back the server? How can this be prevented.
    -> 5000+ emails to send - How can this be done efficiently?

I thinks that all, im sure there will be more along the way. Looking forward to your seggestions.

Thank-you,
Phence

    1. How should I prevent the mail as being labeled as SPAM or BULK mail? (the main reason for this thread- cause the script from my host... stinks!)
    There really is no definitive way from getting it labeled as SPAM or BULK. One way would be to not send it from a non-existant account. Also, don't use Keywords in the subject other than what your site title is or whatever. Most spam/bulk blockers look for certain keywords like "FREE" or "Viagra" or whatever. Keep it concise and it has less chance of getting through.

    And of course, let your recipients know what address the mail is coming from, and have the add it to their "White-list".

    2. What are the different content-types for the PHP mail() function? and im sure they have an effect on the mail.
    well, mainly it's Text/plain or Text/HTML. HTML mail is normally unparsed by modern day software as a security feature. Text/plain is normal email without HTML markup in the body.

    3. Will not sending mass email's hold back the server? How can this be prevented.
    -> 5000+ emails to send - How can this be done efficiently?

    Sending 5000+ emails using the mail() function in PHP will kill your server. It opens and closes a connection to the SMTP server for each message. You may want to look into PHPs IMAP or PEAR::Mail as a better alternative.

    ~Brett

      Brett,
      Thank-you very much for those tips! I would have definately tried to use mail() - i've heard of the others, but forgot about 'em.

      Are there any other major concerns I should have?

      Thanks agian.

        Be wary of how many and how often you send mail. If you're using a shared server and your host sees that your site alone is using an exorbent amount of CPU and memory, they'll cut you off. So even using other packages may not help decrease CPU utilization if you're sending 5k messages; however, it will be less than using mail().

        If you're doing it as an online type of mailer, make sure that your script is "SPAM PROOF". Don't allow hackers in, and don't give the easy access. Make those people that are sending out the emails provide their email logins (address & password & visual confirmation). Check all of those, if they're fine, send the newsletter from that address, not your own (just for responsibility purposes).

        Do validation on any and all data received from forms. Worst thing you could do is allow a hacker an easy target without using mysql_real_escape_string() or allowing any and all HTML. Just be weary.

        With HTML mail you have to think about Java & viruses. If you don't want to allow java, remember to do a check to make sure that the message body doesn't contain:

        <script lang="Javascript" type="text/java"></script>

        tags.

        Use some common sense. Look around the internet on what is going on: Email viruses, injection of code, illegal attachements... a lot from unsuspecting people. Just be careful, and if you run into problems when you don't know how to validate data, or you can't figure out how to fix an injection problem, ask the community.

        ~Brett

          I have my own dedicated server, and one thing I have been lax on is building scripts that need that extra-and-important security step and most effecient step. This is only because the majority of clients I have are small businesses that are mostly not internet dependant - and the fact I am like most, self-taught. BUT I have a few clients now that more internet dependant and I just want to avoid learning some lessons the hard way - some are inevitable.

          I'm going to start writting the script today... Then I think i'll post it in the Code Critique section of the forum - maybe that will be best. I'll be sure to link to it here.

          Keep the Seggestions comming...

            Just Thought of this...
            What about when a person who signs up for the newsletter and then some time down the road their inbox exceeds it alotted space, or their mail server is temporarily shut down?

            Is there a way to handle these problems? I know that most times there is a MAILER-DAEMON response that is sent to the sender. So, if I use my clients' (the user of the Newsletter application) email to send the messages does that mean they will receive the MAILER-DAEMON responses?

            Ofcourse, I wouldn't want that if there were 5+ each time a newsletter was sent out. I mean I could write them a form that they could use to report those emails to try agian or suspend that email that record... but that would waste a lot of time if there were many returns.

            Is there a way to intecept these notices and interperate them to make the necessary resend attempts or suspensions, etc...

            Just a thought.
            Thank-you,
            Phence

              Not sure. Whoever sends the message will get the MAILER DAEMON responses or "bounces". I'm sure if you google the topic, something will show up.

              ~Brett

                Well... i've been reading and trying to write code all week for my Mass Mailing List Script... and have been hitting brick walls.

                It seems many people have struggled with this... keeping cpu usage down and such.

                I've read of these seggestions/solutions...

                [INDENT]

                1. don't use sendmail use exim

                2. don't use php's mail()

                3. use Open Source PHP Class --> like PHPmailer

                4. use a PEAR solution

                5. use a script in the background cron or task scheduler

                6. use SMTP

                7. use IMAP

                [/INDENT]

                I am not really fimiliar with any of these... I think i have a very basic understanding of each of them, but not real sure what is best to use?

                I guess I like PHPmailer so far... but i haven't be able to figure how to effiently use it for a mass mailing (I'm pretty sure that's why it was built, thus it's name PHPMailer). I've read the tutorials at PHPmailers Homepage and PHPfreaks.com but they both cut short at sending MASS Mailers effeciently.

                I'm just looking for a solution that I won't have to re-write for the client that wants to send 100 emails a week or 100,000 a week.

                I like the idea of running a cron script in the background. I know i've seen that posted somewhere in this forum. That's what I'm looking towards now...

                If anyone's has some experiences they have have and solutions they've come up with... i'd love to hear about 'em if they might help.

                Thanks,
                Phence

                  MY CRON SCRIPT

                  Here is my mass mailer script using the phpMailer class running off of a Crontab.

                  I was gonna post it in the code critique section, but i haven't made sure it was bug-free - and i'm certianly not trying to boast of my premier coding skills.

                  So maybe you all could take a look, and let me know if my logic is correct in building this script.

                  I haven't spent much time studing script execution speeds, but i took my best guesses... they could be way off. let me know what you think! PLEEAAZZE!?!

                  Let me know if you think there's a better way to do it?

                  Thanks so much,
                  Phence

                    Umm...I think this says it all:

                    // SEAN, Write a Error and Report log file!! get rid of 'or die (mysql_error());' where a cron gonna output to! duh!

                    THat's the only thing I see....

                    ~Brett

                      Write a Reply...