Subscribe to receive updates on Dada Mail:

Dada Mail Mailing Lists: [dadadev] Re: New Magicbook Topics and Documentation in General

From: "Dada Mail (Justin J)" ...@skazat.com>
Subject: [dadadev] Re: New Magicbook Topics and Documentation in General
In-Reply-To: (no subject)
Date: May 16th 2008


On May 15, 2008, at 7:24 PM, Moshe Katz wrote:

> right now, I have a php script that just pipes its output to
> send_dada_mail.pl.
> I just wanted to know if there is a more elegant way to do it.


That's a pretty good question and I have been working on something.
Here's a draft of some ideas. It doesn't currently work with the
released beta (sometimes, when writing documentation, you come across
bugs, which you fix, while writing the documentation!) , but it will
work in the next release:



Accessing the, ``Send a List Message'' API

If the send_dada_mail.pl script isn't up your alley, you can make a
very small utility script that'll bridge between your app - whatever
language it's written in and Dada Mail. Here's what such an app may
look like:

#!/usr/bin/perl
# Change! The perllibs below to point to Dada Mail's perl
libraries:
use lib qw(
./DADA
./DADA/perllib
/home/myaccount/cgi-bin/dada
/home/myaccount/cgi-bin/dada/DADA/perllib
);
use CGI;
my $q = new CGI;
my $list = $q->param('list');
$q->delete('list');

if($q->param('process')) {
use DADA::App::MassSend;
my $ms = DADA::App::MassSend->new;
$ms->send_email(
{
-cgi_obj => $q,
-list => $list,
-html_output => 0,
}
);
print $q->header();
print "sending is on its way!";

}
else {
print $q->header() ;
print "I don't know what you want me to do!";
}

The above example is an incredibly bare-bones idea on how to send a
list message using the DADA::App::MassSend API. Unfortunetly, the API
isn't super flexible, but it can do a whole lot, if you need it to.

Save the above script as something like, send_list_message.cgi (or
whatever you'd personally like). Put it into your cgi-bin/dada
directory (to start) and change it's permission to, 755

The next thing you'll want to do is create an HTML page with a form
that, when submitted will have the correct information to send a list
message. Here's a very small example:

<form action="http://example.com/cgi-bin/dada/send_list_message.cgi
"; method="post">
<input type="hidden" name="process" value="1" />
<input type="hidden" name="list" value="mylist" />
<p>Subject: <input type="text" name="Subject" value="" /> </p>
<p>PlainText Version: <br />
<textarea name="text_message_body"></textarea>
</p>
<p>HTML Version: <br />
<textarea name="html_message_body"></textarea>
</p>
<p>
<input type="submit" />
</p>
</form>

Breaking this down:

the form field itself

You'll have to tweak the, action paramater to point to the script we
just made.

process

Set this form field value to, 1

list

Set this to a valid list shortname

Subject

The Subject of your message.

text_message_body

The PlainText version of your message (if any)

html_message_body

The HTML version of your message (if any)

Make sure to customize the form's, action to correspond to where
you're currently keeping this script and also the form field, ``list''
to be a valid listshortname of yours.

The form fields, Subject, text_message_body and html_message_body are
named the same as the form fields located on the, Send a List Message
screen. Most every form field that's located in that form can be added
to our example, including file attachments, partial sending options,
archiving options, etc.

Our little example above only shows how to create a form that
basically cicrumvents Dada Mail's own security. If you do use this
form, make sure some semblance of security is put back into your script.

Hopefully, if you're a seasoned Perl programmer, you can edit the
above idea to work more closely within your own Perl program. You
don't need to explicitly post to the script - all you have to do is
fill out the CGI object params, like so:

$q->param('list', 'mylist');
$q->param('process', 1);
$q->param('Subject', 'My Subject');
$q->param('text_message_body', "This is my PlainText
version!");
# etc....
use DADA::App::MassSend;
my $ms = DADA::App::MassSend->new;
$ms->send_email(
{
-cgi_obj => $q,
-list => $q->param('list'),
-html_output => 0,
}
);
What if you're using another language, like php?

My advice, currently, is to call the outside script using something
like php's curl support:

http://us.php.net/curl

The idea is the same, but instead of creating an HTML form you
manually submit, you pass the variables needed to the curl session and
post them to the outside script.

[/snip]

The main idea to this is, any form field that's in the Send a List
Message screen is something you can hand over to this little script,
and it should work exactly the same.

This is quite different from the send_dada_email.pl script, which
wants a fully formatted email message, headers and all, which can be a
quite another step before you can send Dada Mail the message.

<< Previous: [dadadev] New Magicbook Topics and Documentation in General

| Archive Index |

Next: [dadadev] Re: New Magicbook Topics and Documentation in General >>

(archive rss , atom )

this list's archives:


This mailing list is to discuss the nerdy programming development of Dada Mail -

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

http://mojo.skazat.com/support/boards

To post to this list, send a message to:

dadadev@skazat.com

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

Some on topic... topics include:

* Positive Crits 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 internal 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 -

At the moment, there aren't many people with CVS access for Dada Mail - if you would like CVS access, please first talk about the changes you propose and how it will affect the program. If the idea is sound and agreed upon, the change will be comitted. A good track record of this will allow you to have CVS access. Some reasons that patches will not be accepted is if the patch breaks compatibility with a previous version of the program, the patch is too centric to your own problem or the patch simply isn't very good.

Please, please please familiarize yourself with the documentation at:

http://mojo.skazat.com/support/documentation/

Since no one wants to answer the same question twice.

Another sneaky reason for this mailing list is to test out the discussion list capabilities of Dada Mail, since Dada Mail is used for the mailing list itself.

*NOTE* - because of this, there may be times that this list will be somewhat broken. Although we're not planning on breaking the program by using it, we're giving you the heads up that this may well happen anyways.

Subscribe/Unsubscribe on Dada Mail Developers

* Required



Dada Mail is Free Software and is released under the Gnu Public License.
Dada Mail is written in Perl because we love Perl.