Jump to content

Importing Email addresses from database into a form and keeping them seperate


Recommended Posts

  require 'administration.php'; 
if (isset($_POST['submit'])) { // if form has been submitted
    /* check they filled in what they supposed to etc: full name, email and comments */

        if (!$_POST['comments'])
        die('You did not fill in a required field, please refresh.');	

    $_POST['comments'] = strip_tags($_POST['comments']);

	    if (!get_magic_quotes_gpc()) {
        $_POST['comments'] = addslashes($_POST['comments']);
   $message = 
"Dear Customer, \n
$_POST[comments] \n
Thank you. This is an automated response. PLEASE DO NOT REPLY.
        /* Mail To, subject, message */ 
     mail ("CONNECT TO DATABASE TO GET CONTACTS","Todays Newsletter", $message,
    "From: \"Jeanies Poetry Corner\" <Newsletter@Jeanies-Poetry.com>\r\n " . phpversion());
   die('Newsletter has been sent to all the recipents in our database');    


where it says

"CONNECT TO DATABASE TO GET CONTACTS" I need to get the emails addresses from the database.

The database the emails get stored in, is connected to 'Newsletter.php', So I know that

require 'Newsletter.php';

Should be included in it somewhere.

You may need to use this



Is there any way to do this?


Also, as it imports the email addresses from the database, when it sends, would it show all the email addresses that the email sent to on the users email they recieve? If you understand, to make it easier.. lets say, chain mails on MSN, you see all the recipents the email was sent to, would this show up with the code above but connected to the database? If it would show, are you able to stop that from happening, and codes would be nice :)



Link to comment
Share on other sites

if you're talking hundreds of emails to be sent, (mass emailing), try connecting directly to the SMTP server to do so.


otherwise, if it's just a few emails your script will be sending, you could always try just looping the mail function using 'foreach' on the results from the db query.

Link to comment
Share on other sites

It will be mass emailing eventually, im not sure on SMTP mailing, only when it comes to C# do you have any idea what the PHP will be for the mass emailing (as im sure it'll work for few emails anyway)

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.