Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 02-17-2003, 09:52 PM   #1 (permalink)
noppie
Registered User
 
noppie's Avatar
 
Join Date: Feb 2003
Posts: 2
noppie is on a distinguished road
Send a message via Yahoo to noppie
emailing using php

I have been on one end of the internet to the other end.. and found some great emil scripts'
one is jmm.php

With this script I can emiail all the people in my datatbase.. the problem I have is other people want to emal from the database and they are unable to read the scrilpt.

I want peopel to beable to email the people listed in the datatbase without having to using the code but mayba a html form or something..

as I said I have been everywhere and I am new to php.
Naomi
noppie is offline   Reply With Quote
Old 02-17-2003, 10:17 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
hi noopie, .. welcome to codenewbie =)

i'm not exactly clear on what you are trying to do, however you did come to the right place.

i'm a little confused about the other people you want to have access to the list. will the email they send come from their email address?

if so, .. we can help you just make a page which retrieves all the email addresses out of the database and separate them by commas. then the other people can just copy and paste the list into their email program and send the message away.

if you had something else in mind, please elaborate on what you are trying to accomplish.
sde is offline   Reply With Quote
Old 02-18-2003, 08:53 AM   #3 (permalink)
saline
I am red.
 
saline's Avatar
 
Join Date: Feb 2003
Location: Cleveland, OH
Posts: 139
saline is on a distinguished road
I've a couple of questions and then a possible solution.

Are we actually dealing with a database or is it just an address book?

"With this script I can emiail all the people in my datatbase.. the problem I have is other people want to emal from the database and they are unable to read the scrilpt."

Should other people have access to it, are they all using the same computer. Essentially my question is are you having a file permissions problem?

I have a little program that enables people to send messages to my cellphone store here:

http://www.bmrpoetry.com/mailer.html

Really all it does is let people send e-mail from the web, you just type in the e-mail address up top and the message below. I just have the e-mail address default to the network that lets people send things to my phone.

I drop the information from the web page to a perl script like, oh I don't know, this one:

#!/usr/pkg/bin/perl

print "Content-type: text/html\n\n";

print "<HTML><BODY>";

if($ENV{'REQUEST_METHOD'} eq 'GET')
{
@pairs = split(/&/, $ENV{'QUERY_STRING'});
}

foreach $pair (@pairs)
{
($key, $value) = split(/=/, $pair);

$key =~ tr/+/ /;
$value =~ tr/+/ /;

$info{$key} = $value;

}

open(MAIL, "|/usr/sbin/sendmail -t");

print MAIL "To: $info{To} \nFrom: $info{From} \n";
print MAIL "Subject: $info{Subject}\n";
print MAIL "$info{Message}\n";

close(MAIL);

print "Give it a second";

print "</BODY></HTML>";

(for more help with perl check out the perl forums or perl.com or get a book or check out the man pages on unix or look at the source for the interpreter and reverse engineer the syntax and keywords, thats what I usually do. I've got a lot of time on my hands...)

And then in a couple seconds my phone beeps and I have the email that was sent on my phone. You could modify my webpage and the script to achieve what I think you're asking to do.
saline is offline   Reply With Quote
Old 02-18-2003, 10:34 AM   #4 (permalink)
noppie
Registered User
 
noppie's Avatar
 
Join Date: Feb 2003
Posts: 2
noppie is on a distinguished road
Send a message via Yahoo to noppie
this is an actual database-- I designed.
we a peace group and will have a large mailing list..

We can add the information into the database great.

now we need to access the database to beable to email the people in the database.

I got this program below==
it works great--but the problem is not everyoone can read code.. I have a little understanding.

so what i want is anyone in the group to be-able to send an email using the email address in the datatbase. and htmp page would be nice.. I am just stumpted on how to do it.. to convert the code to be user friendly.
help

PHP Code:
<?php
//////////////////////////////////////////////////////////////////////////////

//                                                                          //

//                   Jason's Mass Mailer v1.2                               //

//                                                                          //

//               [[url]http://www.rottmansales.com/jason/[/url]]                       //                          

//////////////////////////////////////////////////////////////////////////////

//                  Configure the following variables                       //

//////////////////////////////////////////////////////////////////////////////

$host "localhost";                //Host
$user "root";                         //Username
$pass "";                         //Password
$database "Mailing_list_for_FORCE";                     //Database name
$table "Name_info";                        //Name of table that has list of emails
$column "Email";                       //Name of column in table that has list of emails
$num_per_loop "5";                //Number of emails sent per page loop (keep number low to avoid page time-out)
$from_name "rainbowstop@attbi.com)"//Reply address email address
$from_email "rainbowstp@attbi.com";                   //Name the emails came from
$mail_subject "Testing email on for email list--just disregard";
$mail_body "This is the test";
$send_html_messages "yes";        //yes - Send html messages,  no - Do not send html messages

//////////////////////////////////////////////////////////////////////////////

//               DO NOT CHANGE ANYTHING BELOW THIS LINE                     //

//////////////////////////////////////////////////////////////////////////////





if (($first_time == "yes") || ($first_time == "")) {

$total_sent "0";
$total_time "0";


$start "0";

$num_to_end $num_per_loop;

}

if (
$first_time == "no") {

$start $start;

$num_to_end $num_per_loop;

}



$mydb mysql_connect($host,$user,$pass);
if (!
$mydb) { echo "Error connecting to database"; die; }

mysql_select_db($database);



$varx $start $num_to_end 1;

$result2 mysql_query("SELECT " $column " FROM " $table " LIMIT " $start ", " $varx "") or die(mysql_error());

$num_left "0";

$clock_start number_format(microtime(),3);

while(list(
$email_addr) = mysql_fetch_row($result2)) {

    
$num_left $num_left 1;

}

$result3 mysql_query("SELECT " $column " FROM " $table " LIMIT " $start ", " $num_to_end "") or die(mysql_error());

while (list(
$column) = mysql_fetch_row($result3)) {



    
$xheaders "From: " $from_name " <" $from_email ">\n";

    
$xheaders .= "X-Sender: <" $from_email ">\n"

    
$xheaders .= "X-Mailer: PHP\n"// mailer

    
$xheaders .= "X-Priority: 6\n"// Urgent message!

    
if ($send_html_messages == "yes") {

        
$xheaders .= "Content-Type: text/html; charset=iso-8859-1\n"// Mime type

    
}

    
mail("$column",

    
"$mail_subject",

    
"$mail_body",

    
$xheaders);

    
$total_sent $total_sent 1;

}

$clock_stop number_format(microtime(),3);

$clock_difference $clock_stop $clock_start;

$total_time $total_time $clock_difference;

mysql_close();





if (
$num_left $num_per_loop) {

    
$next_start $start $num_per_loop;

    
//echo "<a href=\"" . $PHP_SELF . "?first_time=no&start=" . $next_start . "&total_sent=" . $total_sent . "&total_time=" . $total_time . "\">Next " . $num_per_loop . "</a>\n";

    
header("Location: " $PHP_SELF "?first_time=no&start=" $next_start "&total_sent=" $total_sent "&total_time=" $total_time "");

}

if (
$num_left <= $num_per_loop) {

    echo 
"FINISHED<br><br>";

    echo 
"Total Emails Sent: " $total_sent "<br>\n";

    echo 
"Total Script Run Time Used: " $total_time " seconds<br>\n";
    echo 
"<a href=\"" $PHP_SELF "\">Run Again</a><br><br><br>\n";
    echo 
"Provided By: <a href=\"http://www.rottmansales.com/jason/\">[url]http://www.rottmansales.com/jason/[/url]</a><br>\n";

    
end;

}



?>
:rock:
noppie is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Comes of Age sde Code Newbie News 0 04-14-2004 11:41 AM
new to php jhoop2002 PHP 12 08-06-2003 02:45 PM
I need to learn PHP Nitro PHP 9 06-28-2003 11:24 AM
Php Vs. Asp sde PHP 6 06-06-2003 06:02 PM
PHP as CGI?? bdl PHP 8 05-08-2003 08:29 AM


All times are GMT -8. The time now is 10:49 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting