Newsletter script by using PHP MySQL

Opt in email list can be developed by asking users to subscribe to your newsletter. Here users have to add their email address to the list. To verify the ownership of the email address one confirmation email will be posted to subscribed email address of the user.

This script will have two parts.

Part 1 : Registering the user and verification of email address
Part 2 : Managing user and posting of newsletters.

Features of the Newsletter script

  1. Visitor will submit email address and script will check with existing list for matching email record.
  2. If the visitor is previously subscribed and verified email address then system will display message saying 'not required to subscribe again'
  3. If the visitor is previously subscribed and failed to verify email address then script will display message saying the same and give a link to resend the verification mail.
  4. If any unknown email address (previously not joined or confirmed ) try to confirm then system will not allow them
  5. Each verification email will have a link to visit for verification by user.
  6. Within 300 seconds ( can be adjusted ) user needs to confirm subscription by visiting the confirmation link.
Newsletter script process

Demo of subscribing to newsletter

You can test by submitting your email address and you will get confirmation mail in your inbox. Then by clicking the verification mail you can confirm subscription. However this is demo only and not our newsletter box, so we will be deleting or sending you the delete link. Demo for Admin area is not available , however you can install and check at your end. Note that this is for your learning only and this is not to be used for any spamming or any other activity.

Displaying form to collect email address

One simple textbox with a button is to be provided for the user to enter their email address. Here the button will trigger one JavaScript function ajaxFunction() to carry the email address to another script file subscribeck.php by using Ajax.

Learn basics of Ajax and form submission here.

From subscribe.php page we will be sending two data , one is todo and other one is email to subscribeck.php page by POST method ( using Ajax ).

Confirming the email address

Confirmation email will have one link on the body of the email address. Once the user click the link or visit the URL. The script will read unique id , email and random number from the link and match the same with the record. The record will have date and time stored so the matching record will be checked within 24 hours of subscribing. If the record matches with the data provided by the user Link then the email address will be marked as confirmed or subscribed email address.
https://www.plus2net.com/newsletter/confirm.php?email_id=12&token=m0xyr7d9&tm=1404824477&confirm_id=7&email=userid@example.com

Unsubscribing to newsletter.

Posting of newsletters is discussed in Part II. At the bottom of each newsletter there will be one link for the user to click and visit a page at site to un-subscribe from the list. While un-subscribing we will bit liberal and only check for matching email address and unique id associated with the email address. One sample link for unsubscribing looks like this.
https://www.plus2net.com/newsletter/unsubscribe.php?email_id=12&email=userid@example.com&todo=delete


Download zip file for this newsletter script
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com




    Candice

    22-12-2014

    Thank you. This worked. It was simple to copy paste (install), and it was what I was looking for. This is the first time I've not used a CMS and with a little extra courage I think I'm going to make an entire site from scratch.
    malik

    09-03-2015

    it said Error!: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

    What to do?
    mehran

    12-03-2015

    Hi, Thank you for this useful script

    but one question!

    How I can send email as HTML Content. in current case my content send as simple text

    thank you,
    smo

    13-03-2015

    Hi Malik
    Open the config file and enter correct userid and password for your database connection.
    zibx

    01-04-2016

    Does this script allow to manually add email addresses?
    smo1234

    07-04-2016

    Adding manually is not included. This can be added within Admin interface. You have to decide on going for email address confirmation or not.
    badr

    28-09-2017

    admin password?
    jyoti

    20-06-2018

    what is admin ..userid and password
    smo1234

    02-08-2018

    While installing you have to add admin id and password.
    Read the second part of this tutorial about installation

    14-09-2020

    Thanks for the tutorial. Really good effort!

    Post your comments , suggestion , error , requirements etc here .




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer