How To Build A Bulk Email Sending Application In PHP

  • 33,736 views
Uploaded on

Techniques, tools, best practices and tools to create a full blown bulk mailing application in PHP.

Techniques, tools, best practices and tools to create a full blown bulk mailing application in PHP.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • We are providing bulk email solution
    Cheap Dedicated server with multiple IP Address
    PowerMTA email Server and Interspire Email marketer
    Contact Us
    Skype ID : san2roy
    Gtalk ID : san2roy
    Email : san2roy @ gmail .com
    Are you sure you want to
    Your message goes here
  • nice blog and good contents india smtp service provider
    Are you sure you want to
    Your message goes here
  • This blog is good but the sometimes mails can be differed know more solutions on India Smtp service provider
    Are you sure you want to
    Your message goes here
  • @michellegarajales please contact www.inbiogen.com, we have better solution for you.
    Thanks
    Are you sure you want to
    Your message goes here
  • Hi,
    I am interested in doing business with
    your company, I have a bulk email list
    that I need to send every month, the list
    contains 2 million emails, I am not
    looking for a service to send it out for
    me, I need to be able to login to the
    server, setup the MySQL, setup my bulk
    email script and then send out these
    emails myself, my question is can your
    company provide me this service of server
    I can use? And if so then how much per
    month you are going to charge me? And is
    it only one IP you will provide me or
    more than one? And are your IPs clean or
    any on any blacklists? Keep in mind that
    I follow the law and in accordance with
    the antispam act, and all emails have
    unsubscribe links. If you Don't provide
    this service, do you know a company you
    can refer me to that can? Kindly let me
    know ASAP.

    Thank you.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
33,736
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
357
Comments
7
Likes
15

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Sending Bulk Email Using PHP By Sudheer Satyanarayana http://techchorus.net
  • 2. Table Of Contents
      • Bulk email challenges
      • 3. Tools and techniques
      • 4. Best practices
      • 5. Sample code
      • 6. Question and answers
  • 7. Challenges
      • User's expectations
      • 8. Outgoing emails restrictions set by hosting providers
      • 9. Incoming email filters set by recipient servers and their users
      • 10. Compliance - legal and tacit agreements
      • 11. Avoiding getting blacklisted
  • 12. Prerequisites
      • Opt-in list
      • 13. Own email server for full blown solution
        • Servers are becoming less expensive
          •   Amazon - $0.085 per hour / INR 3.99 per hour
          • 14.   Rackspace Cloud - 1.5¢ per hour / INR 0.7 per hour
  • 15. Identity And Branding
      • Use dedicated public static IP address
      • 16. Have correct reverse DNS record for your IP address
      • 17. Have up to date contact information in WHOIS record
      • 18. Monitor postmaster and abuse mailboxes
      • 19. Have a consistent from header
      • 20. Have SPF records
      • 21. Sign messages using DKIM
  • 22. Identity And Branding - Reverse DNS
      • Forward DNS lookup maps domain name to an IP address
      • 23. Reverse DNS lookup maps IP address to a domain
      • 24. Server hosting providers offer a way to set the reverse DNS entry in their control panels
    Example 31.41.51.61 pointing to myserver.example.com
  • 25. Headers Email contains two major sections Header   Header sections fields   Example fields - From, To, Subject, Date, Message-Id Body   Unstructured
  • 26. Sample Email With Headers
  • 27. Use A PHP Library Prefer SMTP over sendmail     Popular PHP libraries that support SMTP
      • Zend Framework - Zend_Mail
      • 28. PHPMailer
      • 29. Swift Mailer
     
  • 30. Zend_Mail Sample Usage Configure SMTP Before You Send.   Use this snippet if SMTP authentication is not required  $config = array ( 'name' => 'myserver.example.com' ) ; $transport = new Zend_Mail_Transport_Smtp ( 'myserver.example.com' , $config ) ; Zend_Mail_Transport_Smtp ( 'myserver.server.com' , $config ) ; Zend_Mail:: setDefaultTransport ( $transport ) ;
  • 31. Zend_Mail Sample Usage Use this snippet if SMTP authentication is required  $config = array (        'auth' => 'login' ,      'username' => 'myusername' ,      'password' => 'password' ) ; $transport = new Zend_Mail_Transport_Smtp ( 'myserver.server.com' , $config ) ; Zend_Mail:: setDefaultTransport ( $transport ) ;
  • 32. Zend_Mail Sample Usage $mail = new Zend_Mail () ; $mail -> setBodyText ( 'Hello World!' ) ; $mail -> setFrom ( 'you@example.com' , 'You' ) ; $mail -> addTo ( 'me@example.com' , 'Me' ) ; $mail -> setSubject ( 'Greetings' ) ; $mail -> send () ; From, To, Subject headers are automatically set by Zend_Mail. Zend_Mail also handles MIME encoding.
  • 33. Identity And Branding - SPF Record
      • Sender Policy Framework
      • 34. Email Validation System
      • 35. Have a text DNS record and publish your policy
      • 36. Recipient servers validate sender by reading your DNS record
    SPF Example: "v=spf1 ip4:192.168.0.1/16 -all" Allow any IP address between 192.168.0.1 and 192.168.255.255. Use the SPF record generator http://old.openspf.org/wizard.html
  • 37. Identity And Branding - DKIM
      • DomainKeys Identified Mail  
      • 38. A method for email authentication
      • 39. Public key cryptography
    Example Header DKIM-Signature: d=example.com s=myserver  b=MTI...I=;
  • 40. List Management - Subscribing
      • Let users explicitly opt in to your lists
      • 41. Verify the subscriber's email address
      • 42. Consider double opt in
      • 43. Avoid purchasing lists
      • 44. Send subscription reminders to users. Offer methods to unsubscirbe from the lists the user may no longer be interested in.
         
  • 45. List Management - Unsubscribing
      • A link in every email. Do not ask the user to login to unsibscribe
      • 46. Do not force the user to fill in 'reason' field in the unsubscribe form field. Use unsubscribe form only for confirmation.
      • 47. Provide a 'List-Unsubscribe' header
      • 48. Automatically unsubscribe users whose addresses have reached a bounce threshold. Use VERP.
     
  • 49. List Management - Unsubscribing List-Unsubscribe Header $mail = new Zend_Mail () ; $mail -> setBodyText ( 'Hello World!' ) ; $mail -> setFrom ( 'you@example.com' , 'You' ) ; $mail -> addTo ( 'me@example.com' , 'Me' ) ; $mail -> setSubject ( 'Greetings' ) ; $mail -> addHeader ( 'List-Unsubscribe', 'mylist-unsubscribe@my.example.com' ) ; $mail -> send () ;
  • 50. List Management - Unsubscribing List-Unsubscribe Header With Unique Identifier $mail -> addHeader ( 'List-Unsubscribe', 'mylist-unsubscribe+myuniqueidentifier@my.example.com' ) ;
  • 51. List Management - Unsubscribing
      • Return-Path Header
      • 52. Return-Path header's value is usually same as From
      • 53. Depends on your email server setting
      • 54. When an email is bounced the details are sent to the email address specified in the Return-Path header
    Return-Path: me@my.example.com From: me@my.example.com
  • 55. List Management - Unsubscribing
      • VERP - Variable envelope return path
      • 56. Automatic Bounce Handling
      • 57. Make use of Return-Path header
      • 58. Return-Path: me+specially_encoded_recipients_email@my.example.com
      • 59. Server must support VERP
     
  • 60. List Management - Unsubscribing Without VERP   Return-Path: me@my.example.com With VERP Return-Path: me+you=you.example.com@my.example.com Use POP to fetch mails of me@my.example.com and parse the Return-Path header.
  • 61. List Management - Unsubscribing Automatic Bounce Handling - VERP Fetching mail using POP   $mail = new Zend_Mail_Storage_Pop3 ( array (        'host'      => 'localhost' ,      'user'      => 'test' ,      'password' => 'test' )) ; foreach ($mail as $messageNumber=>$message) { $headers = $message->getHeaders(); $to = $headers['to']; //... }
  • 62. Delivering To Inbox
      • Ask the user to add your email address set in the from header to their address books
      • 63. If falsely flagged as SPAM, ask the users to flag the email as not SPAM
      • 64. Use separate from email address for transactional emails and promotional emails
      • 65. Use separate IP address for transactional emails and promotional emails
      • 66. Use separate domains for transactional emails and promotional emails
  • 67. Settings To Administer The Program
      • Number of outgoing emails per hour
      • 68. Number of outgoing emails per hour per domain
      • 69. List of blacklisted domains
      • 70. Delay between outgoing emails
      • 71. Process bounce handling every __ hours
      • 72. Bounce treshold
  • 73. Tips And Tricks
      • Log every action
      • 74. Respond to user's complaints
      • 75. Apply for whitelists when you have a problem
    Sample entities subscriber - email, preferred format, name list - name list_subscriber - lookup table. One subscriber can belong to many lists. message - subject, text body, HTML body message_queue - subscriber_id, message_id, list_id, sent, sent_time, unique_identifier
  • 76. Thank You Contact - sudheer.s@sudheer.net http://techchorus.net http://projects.binaryvibes.co.in/projects/show/bare http://projects.binaryvibes.co.in/projects/show/bizsense http://binaryvibes.co.in
  • 77. Licence Sending Bulk Email Using PHP by Sudheer Satyanarayana is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 2.5 India License . Based on a work at techchorus.net . Permissions beyond the scope of this license may be available at http://techchorus.net .