Newsletter script by using PHP MySQL
Optin 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
- Visitor will submit email address and script will check with existing list for matching email record.
- If the visitor is previously subscribed and verified email address then system will display message saying 'not required to subscribe again'
- 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.
- If any unknown email address (previously not joined or confirmed ) try to confirm then system will not allow them
- Each verification email will have a link to visit for verification by user.
- Within 300 seconds ( can be adjusted ) user needs to confirm subscription by visiting the confirmation link.
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.
Subscribe to demo of this newsletter script
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
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.
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 unsubscribe from the list. While unsubscribing 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.
Posting Newsletter to subscribers & Script Installation .
Number of User Comments : 4
|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. |
|it said Error!: SQLSTATE[HY000]  Access denied for user 'root'@'localhost' (using password: YES)|
What to do?
|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
Open the config file and enter correct userid and password for your database connection.