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:
[snip]
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">
Subject:
PlainText Version:
HTML Version:
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
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:
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:
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.
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.