Re: Creating a new list via API does not generate all values

 
From: "Samer Bechara" <farrooda@PROTECTED>
Date: May 5th 2009

Hi Carl,

I removed a couple of things from the code, which were specific to my situation File attached

You will have to do the following:

1) Install dadamail 2) Change line 9: "use lib '/var/www/cgi-bin/smartdev/list'; " to your dadamail install path 3) Change line 23: The name of the list you want to clone, currently it's SmartWeb 4) Save the file as list-clone pl 5) Run it as root using the following command: " /list-clone pl NewListName NewListPass email@address com"

Let me know if you face any problems

--Samer

Carl G Kuczun wrote: >

Hi Samer,

The clone-a-list code is something I have been looking for Can you provide instructions on how to create the API and where this code is put? Thanks

CarlK

----- Original Message ----- From: "Samer Bechara" farrooda@gmail com To: "Dada Mail Developers Subscriber" ckuczun@PROTECTED Sent: Monday, May 04, 2009 12:31 PM Subject: Re: Creating a new list via API does not generate all values

I have attached the whole code to clone a list via API, it should be useful for someone Comments are inside

--Samer

Justin J wrote: >

>

I am trying to create a new list via the Dadamail API I am using the DADA::MailingList Create method

However, when I create the list, only 4 fields are being inserted into the database (list, admin_menu, cipher_key, fallback_field_values) I checked the LIST_SETUP_DEFAULTS variable, and it contains all the elements However, for some reason, these aren't being loaded into the database (MySQL backend) Why is this occurring?

I know you've solved your problem using a different method, but would you mind posting the code you were trying to get working when using, DADA::MailingList::Create?

--

Post: dadadev@dadamailproject com

Unsubscribe: http://dadamailproject com/cgi-bin/dada/mail cgi/u/dadadev/

List Information: http://dadamailproject com/cgi-bin/dada/mail cgi/list/dadadev

Archive: http://dadamailproject com/cgi-bin/dada/mail cgi/archive/dadadev

Mailing List Powered by Dada Mail http://dadamailproject com/cgi-bin/dada/mail cgi/what_is_dada_mail/


!/usr/bin/perl

use strict;

This program adds a new mailing list to dadamail via API, it takes

the following arguments:

1) The name of the list to be created

2) The password of the list

3) The email address of the list owner, e g address emails are

being sent from

use lib '/var/www/cgi-bin/smartdev/list';

use DADA::MailingList; use DADA::MailingList::Settings; use DADA::Security::Password;

Create List - Returns a DADA::MailingList::Settings object

Here is where I was getting the error, only 4 fields

were being added: list, admin_menu, cipher_key, fallback_field_values


my $ls = DADA::MailingList::Create({ list => $ARGV[$0] });

Get values from template list

my $templatels = DADA::MailingList::Settings->new( { -list => 'SmartWeb', # SmartWeb is the name of the template list } ); my $params = $templatels->get;

Apply all settings of the template mailing list to the list just

created while ( my ($key, $value) = each(%$params) ) {

Skip the list param which is unchangeable

if($key eq "list"){ next; }

$ls->param($key, $value); }

Generate the password from second argument

my $enc_pass = encrypt_passwd($ARGV);

   # Save a setting
   $ls->save(
           {
                   list_name => "John Brennan Hair - "
$ARGV,

info => $params->{info} ", " $ARGV " branch", password => $enc_pass, list_owner_email => $ARGV, privacy_policy => $params->{privacy_policy}, physical_address => "John Brennan Hair, " $ARGV ", Australia", } );

exit 0;

--

Post: dadadev@PROTECTED

Unsubscribe: http://dadamailproject com/cgi-bin/dada/mail cgi/u/dadadev/

List Information: http://dadamailproject com/cgi-bin/dada/mail cgi/list/dadadev

Archive: http://dadamailproject com/cgi-bin/dada/mail cgi/archive/dadadev

Mailing List Powered by Dada Mail http://dadamailproject com/cgi-bin/dada/mail cgi/what_is_dada_mail/

  • This mailing list is a public mailing list - anyone may join or leave, at any time.
  • This mailing list is a group discussion list (unmoderated)
  • Start a new thread, email: dadadev@dadamailproject.com

This is the developer discussion mailing list for Dada Mail.

If you are just looking for support Dada Mail, consult the message boards at:

https://forum.dadamailproject.com

Documentation for Dada Mail:

https://dadamailproject.com/d

Specifically, see the Error FAQ:

https://dadamailproject.com/d/FAQ-errors.pod.html

To post to this list, send a message to:

mailto:dadadev@dadamailproject.com

All subscribers of this list may post to the list itself.

Topics that are welcome:

  • Constructive critiques on the program (I like, "x", but, "y" needs some work - here's an idea on how to make this better...)
  • Bug/Error reports
  • Bug fixes
  • Request For Comments on any changes to the program
  • Help customizing Dada Mail for your own needs
  • Patches
  • Language Translations
  • Support Documentation/Doc editing, FAQ's, etc.
  • Discussion of any changes that you would like to be committed to the next version of Dada Mail -

Dada Mail is on Github:

https://github.com/justingit/dada-mail/

If you would like to fork, branch, send over PRs, open up issues, etc.

Privacy Policy:

This Privacy Policy is for this mailing list, and this mailing list only.

Email addresses collection through this mailing list are used explicitly to work within this email discussion list.

We only collect email addresses through our Closed-Loop Opt-In system.

We don't use your email address for any other purpose.

We won't be sharing your email address with any other entity.

Unsubscription can be done at any time. Please contact us at: justin@dadamailproject.com for any help regarding your subscription, including removal from the mailing list.

All mailing list messages sent from us will include a subscription removal link, which will allow you to remove yourself from this mailing list automatically, and permanently.

All consent to use your email address for any other purpose stated at the time of the mailing list subscription will also be revoked upon mailing list removal.