• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

Simple php based subscription submision box

I have a static website on a LAMP. I already use a PHP script for the contact form. Now I need a small subscription box - PHP based - where people can leave / submit their email address so the client can send them e-letter or updates by email.  I considered a free MailChimp account first, but it seems rather hard to make my own subscription box connected to a MailChimp account so I am considering a simple email submission form that is not to vulnerable spam wise. Any scripts out there or other solutions available for me?
0
rhandalthor
Asked:
rhandalthor
  • 4
  • 2
  • 2
3 Solutions
 
john-formbyCommented:
Do you just want to be emailed the email address or do you want to store the submitted email in a database?
0
 
V4nP3rs13Commented:
Check out on hotscripts.com
there are many scripts for this, and all is free
0
 
V4nP3rs13Commented:
Check out on hotscripts.com
there are many scripts for this, and all is free
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
rhandalthorAuthor Commented:
@ john-formby I was more thinking about emailing it to an email address for now.
@ V4nP3rs13 I am familiar with hotscripts. Just rather vast. Will have another look
@ all Any favorite scripts for just sending an email address to a designated email address?
0
 
rhandalthorAuthor Commented:
Found PHPMailer: http://www.phphq.net/scripts.php?script=phMailer#phMailer , but it seems to be a bit too much for just sending an email address to a designated email address. Furthermore I am not certain if it is spam proof. Anybody any experience with this script in using at as a subscription form box? Any other options?
0
 
rhandalthorAuthor Commented:
Anyone any feedback on this?
0
 
john-formbyCommented:
A lot of scripts will package other functionality.  If all you want is a simple script to send a submitted email address to you, then please see the little script I have written below.  This should do exactly what you need.

Just change the $to email to yours and upload to your server.

Hope this helps,

John
<?php
if(isset($_POST['submit'])) {
	$email = $_POST['email'];
	if($email == '') {
		$errormsg = 'Error: No email entered';
	} elseif(!preg_match('/^[^@]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$/', $email)) {
		$errormsg = 'Error: Invalid email address';
	}
	if($errormsg == '') {
		$to = 'you@youremail.com';
		$subject = "Newsletter Subscriber";
		$message = "Please add the following email to your mailing list:\n\n$email";
		$headers = "From: $email";
		mail($to,$subject,$message,$headers);
		$successmsg = 'Success: Mail Sent';
	}
}
?>
<html>
<head>
<title>Email Submission</title>
</head>
<body>
<?php 
echo $errormsg;
echo $successmsg;
?>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
Email: <input type="text" name="email" /> <input type="submit" name="submit" value="Send" />
</form>
</body>
</html>

Open in new window

0
 
rhandalthorAuthor Commented:
Thanks John-formby. Will use this one.
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now