Hello,
I want to make a module for configuring majordomo mailing list. Configuring, like adding and removing members is done via mail.
I keep track who is currently in the list in a database table. Inserting and removing from the database works. But where do I put the code for sending the mail to the majordomo server?
Example:
For each member new to the database table I have to send a line like
subscribe...
A similar line has to be send when a member has to be removed.
Where to put it? onBeforeWrite()?
My code right now is:
class MailinglistePage extends Page {
static $db = array(
'Description'=>'Text',
'EMail'=>'Text'
);
static $has_one = array('Admin'=>'Member'
);
static $many_many = array('MailUser'=>'Member'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$f->addFieldToTab('Root.Content.Main', new TextField('Description', 'Description'));
$f->addFieldToTab('Root.Content.Main', new EmailField('Description', 'Description'));
$f->addFieldToTab("Root.Content.Mitglieder", new ManyManyDataObjectManager(
$this,
'MailUser',
'Member',
array('Surname' => 'Surname',
'Firstname'=>'Firstname',
'Email'=>'Email'
),
'getCMSFields'
));
return $f;
}
function onBeforeWrite() {
// CAUTION: You are required to call the parent-function, otherwise sapphire will not execute the request.
parent::onBeforeWrite();
}
}