#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2004
    Location
    Boston, MA USA
    Posts
    529
    Rep Power
    50

    Email Batch Send API?


    Hi:

    I have a web based business management tool focused on a very specific industry, written in PHP/MySQL. A small, but very important part of the suite of tools is the ability to send bulk emails to a number of customers based on varying search criteria. What is important about the current system is that it extracts customer and sales information from the database so every email is very specifically targeted using specific customer requirements.

    I currently simply use the PHP Mail() function and iterate through a loop, with a pause between each send. This works great and my customers rely on it for communicating with their customers.

    However, as the system has grown the use of the email function has expanded and now, not surprisingly, my hosting company is complaining that the quantity of emails is taxing their server.

    So, I am looking for an alternate solution: I really, I would like to use the current system to compose the email, extract data assemble the distribution list and then use another service (via API?) to simply send the emails.

    I have explored Constant Contact but I think that will not do what I want. I am currently investigating "MailJet"

    Does anyone have experience with this? Is there a better way to do what I want to do? Are there other resources for sending Bulk emails?

    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,312
    Rep Power
    630
    I use MailJet and it works quite well.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,072
    Rep Power
    4101
    I've not tried any of the services out there so I can't comment on them much.

    If all you need is to send emails and don't need analytics and such like the services provide, one alternative you could consider is just getting a cheap VPS and setting it up as a mail server. Have your application send emails via it rather than your web host. Just make sure it's setup properly and securely so it doesn't become a source of spam.
    Recycle your old CD's



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2004
    Location
    Boston, MA USA
    Posts
    529
    Rep Power
    50
    Great! Thanks for the reply.

    Which API do you use? cURL? PHP Wrapper?

    Is there a good sample of usage you can point me to?

    Thanks again!
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,312
    Rep Power
    630
    Python API.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2004
    Location
    Boston, MA USA
    Posts
    529
    Rep Power
    50
    So, I've been able to send a simple email using the MailJet PHP API; it seems pretty straight-forward.

    The problem I'm having is that when I try to send an HTML format message, it comes through as source text (displaying the HTML tags).

    My code looks like this:

    PHP Code:
    include("php-mailjet-v3-simple.class.php");

    // [WHILE Loop for multiple email addresses]

    // Build HTML Content ($email_body)

    $mj = new Mailjet("$MJ_APIKEY_PUBLIC","$MJ_APIKEY_PRIVATE");

                    
    $params = array(
                        
    "method" => "POST",
                        
    "from" => "$sender",
                        
    "to" => "$to",
                        
    "subject" => "$subject",
                           
    "text" => "$email_body"
                    
    );

                    
    $result $mj->sendEmail($params);

    // [END of WHILE loop]

    Can anyone explain why the email is coming through as straight text
    Last edited by SeanF; August 5th, 2017 at 01:09 PM.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,312
    Rep Power
    630
    I can't tell how you are building the HTML body. However, even if you do that correctly you need to add the content-type headers for it to be recognized. I don't know where you are doing any of that.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  14. #8
  15. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,072
    Rep Power
    4101
    Originally Posted by SeanF
    PHP Code:
    include("php-mailjet-v3-simple.class.php"); 
    Why are you using that? You're not supposed to be using it anymore

    Originally Posted by MailJet
    READ THIS FIRST!!
    This repository is now considered deprecated and won't undergo further development. Please refer to the new one.
    Recycle your old CD's



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud

IMN logo majestic logo threadwatch logo seochat tools logo