loader

Subscribing/Unsubscribing from Majordomo Print

  • 3

Subscribing/Unsubscribing from Majordomo


You can subscribe and unsubscribe users to a mailing list by editing the mailing list through your DirectAdmin control panel. See the
Majordomo Mailing List Manager tutorial for more information.

Users can also subscribe and unsubscribe to a list themselves by using Majordomo's email-based command interface. This tutorial will also provide and example of how to create a php script to accomplish this task for your users.

 

How to subscribe and unsubscribe via email
All majordomo commands are sent to [email protected]. It is also important to note that all commands are sent in the body of the message.
To subscribe, a user simply sends an email to
[email protected] with the following in the body of the message:
subscribe list-name 
where list-name is the name of your mailing list. You can also use this interface to unsubscribe:
unsubscribe list-name 
Example php script to allow users to subscribe and unsubscribe from a form on your web page
Create an html or php file with the following code in it or copy it to an existing page in your site:
<form method="post" action="list_command.php"> Your email address: <input type="text" name="email_addr"> <br/> <input type="radio" name="command" value="subscribe" checked> Subscribe <br/> <input type="radio" name="command" value="unsubscribe"> Unsubscribe <br/> <input type="submit" value="Submit"> </form> 
Now create a php file called list_command.php with the following code in it:
<?php $command = $_POST['command']; $email_addr = $_POST['email_addr'];  $list_name = 'your-list'; $to_addr = ' [email protected]    '; $body = $command . ' ' . $list_name; mail($to_addr, '', $body, "From: $email_addr"); echo 'Your request to ' . $command . ' to the list ' . $list_name . ' has been processed.'; ?> 	
Be sure to substitute the variables list_name and to_addr with your appropriate information.

 

Important Note: By default, lists are configured so that subscribing requires confirmation from the user. You are strongly encouraged to keep this setting. Changing it to an open subscription policy will allow unwanted users to register anyone without confirmation (spam). Changing this policy may result in termination of your account.


Was this answer helpful?

« Back