eschamp Posted October 21, 2006 Share Posted October 21, 2006 Hi. Sorry of this is not the right place to post this.I'm looking for a script for a mailing list (i.e., "discussion", not "newsletter") that can be installed and run without the need for superuser privileges.Any suggestions?I've done a fair amount of looking and cannot tell without downloading and extracting the INSTALL file whether or not root access is required.Thanks. Quote Link to comment Share on other sites More sharing options...
ksteuber Posted October 25, 2006 Share Posted October 25, 2006 I'm not sure what you mean by[quote]"discussion", not "newsletter"[/quote]but as for a mailing list, are you looking for something like this?[code]<?php$mailinglist=file("mailinglistfile.txt");$myemailaddress="example@domain.com";$subject="The Subject of this Email";$msg="Hello, I am sending you all this message.";$headers='From: '.$myemailaddress."\r\n".'MIME-Version: 1.0'."\r\n".'Content-type: text/html; charset=iso-8859-1'."\r\n";foreach($mailinglist as $theiremailaddress){mail($theiremailaddress,$subject,$msg,$headers);}?>[/code] Quote Link to comment Share on other sites More sharing options...
eschamp Posted October 25, 2006 Author Share Posted October 25, 2006 Thank you but that's not it.A mailing list is one that has a central email address to which members send messages, which are then distributed to all members.Like Listserv, Mailman, etc. Quote Link to comment Share on other sites More sharing options...
marcus Posted October 26, 2006 Share Posted October 26, 2006 store all the emails in a file and separate each on by a |then do this[code]<?php$to1 = explode("|", "filename.txt");$to = $to1;$youremail = your@email.com;$subject= yoursubject;$msg = yourmessage;$headers='From: '.$youremail."\r\n".'MIME-Version: 1.0'."\r\n".'Content-type: text/html; charset=iso-8859-1'."\r\n";mail($to,$subject,$msg,$headers);?>[/code] Quote Link to comment Share on other sites More sharing options...
eschamp Posted October 26, 2006 Author Share Posted October 26, 2006 I'm sorry for not being more clear.The script resides on a server and runs unattended. When an email to the mailing list address arrives, the script picks it up, checks that the sender is a list member and then resends the body of the message.For a better explanation, see http://en.wikipedia.org/wiki/Electronic_mailing_listThanks. Quote Link to comment Share on other sites More sharing options...
php_joe Posted October 26, 2006 Share Posted October 26, 2006 So, basicly you want to copy Yahoo Groups, right?Use the code above, and modify it thusly:[code]<?php$file = file_get_contents("filename.txt");if(!eregi($youremail, $file)) die();$to1 = explode("|", $file);foreach($to1 as $key => $value){$to = $value;$subject= yoursubject;$msg = yourmessage;$headers='From: '.$youremail."\r\n".'MIME-Version: 1.0'."\r\n".'Content-type: text/html; charset=iso-8859-1'."\r\n";mail($to,$subject,$msg,$headers);}?>[/code]Let me know if it works :)Joe Quote Link to comment Share on other sites More sharing options...
eschamp Posted October 26, 2006 Author Share Posted October 26, 2006 [quote author=php_joe link=topic=112291.msg458053#msg458053 date=1161880319]So, basically you want to copy Yahoo Groups, right?[/quote]No, i don't.[quote]Use the code above, and modify it thusly:[code]<?php$file = file_get_contents("filename.txt");if(!eregi($youremail, $file)) die();$to1 = explode("|", $file);foreach($to1 as $key => $value){$to = $value;$subject= yoursubject;$msg = yourmessage;$headers='From: '.$youremail."\r\n".'MIME-Version: 1.0'."\r\n".'Content-type: text/html; charset=iso-8859-1'."\r\n";mail($to,$subject,$msg,$headers);}?>[/code]Let me know if it works :)Joe[/quote]I have some questions about your script. The first is how do I get an email addressed to some user on the server where the script resides to trigger the script?Thanks. Quote Link to comment Share on other sites More sharing options...
php_joe Posted October 27, 2006 Share Posted October 27, 2006 I don't know how you'd do it via email but you could just make a webform and attach the variable $youremail to their email address and then put this script in the page that you submit to.Joe Quote Link to comment Share on other sites More sharing options...
eschamp Posted October 27, 2006 Author Share Posted October 27, 2006 Thanks but that would require my intervention for every email sent to the list's email address.I'm looking for something that runs unattended.There are scripts on the script sites that let the list owner send a "newsletter" to a bunch of email addresses and I think that's what you've come up with.My requirements are a bit different.Actually, I think that there are scripts that already exist for this; I just cannot find them! Quote Link to comment Share on other sites More sharing options...
Netty Posted October 27, 2006 Share Posted October 27, 2006 search http://php.resourceindex.com Quote Link to comment Share on other sites More sharing options...
eschamp Posted October 27, 2006 Author Share Posted October 27, 2006 [quote author=Netty link=topic=112291.msg458680#msg458680 date=1161972389]search http://php.resourceindex.com[/quote]Thanks. That was one of the first places I looked. The descriptions are generally inadequate and it looks like the only way to find out if a script is suitable is to download it!I was hoping that someone in this forum might have some experience with one or more of these existing script. Quote Link to comment Share on other sites More sharing options...
ksteuber Posted October 28, 2006 Share Posted October 28, 2006 Somebody correct me if I'm wrong, but in order to run a php script, apache has to request the page (which is usually a result of a person's browser requesting the page), so if you want a script to resond to email rather than browser requests, wouldn't you have to somehow integrate PHP with a POP3 server.I know Nothing about POP3 servers. Can you even do that? Quote Link to comment Share on other sites More sharing options...
php_joe Posted October 28, 2006 Share Posted October 28, 2006 [quote]Thanks but that would require my intervention for every email sent to the list's email address.[/quote]No, you could set it up so that it's automatic. Just like this forum that sends emails to members who have "subsrcribed" to a particular topic.Just give each member a "moderated" or "unmoderated" status and, if they're "unmoderated" have the code loop through a list of email addresses and [b]mail()[/b] each one.Joe Quote Link to comment Share on other sites More sharing options...
eschamp Posted October 28, 2006 Author Share Posted October 28, 2006 [quote author=php_joe link=topic=112291.msg458906#msg458906 date=1162007625][quote]Thanks but that would require my intervention for every email sent to the list's email address.[/quote]No, you could set it up so that it's automatic. Just like this forum that sends emails to members who have "subsrcribed" to a particular topic.Just give each member a "moderated" or "unmoderated" status and, if they're "unmoderated" have the code loop through a list of email addresses and [b]mail()[/b] each one.Joe[/quote]Way beyond my ability to code in PHP. Thanks. Quote Link to comment Share on other sites More sharing options...
php_joe Posted October 28, 2006 Share Posted October 28, 2006 It's not so hard. :)When you're faced by a difficult project just break it into partsWhen they're setting up their account have a code like this in the register page:-------------------------------------------------------------------------$profile = './accounts/{$username}_profile.php";$address_list = './accounts/addresses.php";if(!file_exists($path) { [b]// does the profile already exist?[/b]$new_profile_content = "<?\n\$status = \"unmoderated\";\n\$email = \"$register_email\";\n?>"; [b]// what to put in the profile[/b]$add_register_email = "$register_email\n"; [b]// the user's email address with a line break added[/b]$new_profile = fopen($path, "w"); [b]// create the profile[/b]fwrite($new_profile, $new_profile_content); [b]// write the info[/b]fclose($new_profile); [b]// close the profile[/b]$add_address = fopen($addresses, "a+"); [b]// open the addresses.php[/b]fwrite($add_address, $add_register_email); [b]// add the address[/b]fclose($add_address); [b]// close addresses.php[/b]}-------------------------------------------------------------------------(The register page will have to provide the $username and $register_email)Then, when they submit a message at your webpage use this code:-------------------------------------------------------------------------$profile = './accounts/{$username}_profile.php";$address_list = './accounts/addresses.php";require "$profile"; [b]// get their profile info[/b]if($status == "unmoderated"){$subject = 'the subject'; [b]// your subject[/b]$message = 'hello'; [b]// your message[/b]$headers = 'From: $email' . "\r\n" . 'X-Mailer: PHP/' . phpversion();$addresses = file($address_list); [b]// turn addresses.php into an array[/b]foreach($addresses as $key => $value){ [b]// for each one...[/b]$to = "$value";mail($to, $subject, $message, $headers); [b]// send them the message[/b]}} [b]// all done![/b]-------------------------------------------------------------------------Of course, this is just off the top of my head and may need some tweaking to work right. Quote Link to comment Share on other sites More sharing options...
eschamp Posted October 28, 2006 Author Share Posted October 28, 2006 Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.