[TYPO3-english] Using mailform from custom extension

Jan Bednarik info at bednarik.org
Mon Aug 17 17:24:24 CEST 2009


Hi,

I've orginally posted this question to typo3.dev, but nobody answered, 
so I'm trying it here. Sorry for cross-posting, but I'd really like to 
head some option on this.

I'm trying to send an e-mail from an extension of mine. I've defined TS 
setup for the mailform:

plugin.tx_productsmail_pi1 {
mailform < tt_content.mailform.20
mailform {
data >
recipient >
recipient = info at example.com
redirect >
dataArray {
10.label = Typ:
10.type = title=input,40
10.value = title
10.required = 1
100.type = formtype_mail=submit
100.value = Send
}
}
}

then I render the mailform like this:

$content = $this->cObj->FORM($conf['mailform.']);

So far it's OK. The problem is, that no mail is sent. Reason is in 
tslib_fe::sendFormmail()

Since TYPO3_CONF_VARS['FE']['secureFormmail'] == true, this piece of 
code is executed:

$locData = explode(':',$locationData);
$record = $this->sys_page->checkRecord($locData[1],$locData[2],1);
$EMAIL_VARS['recipient'] = $record['subheader'];
$EMAIL_VARS['recipient_copy'] = 
$this->extractRecipientCopy($record['bodytext']);

but since there is no record in any page (as it's TS only), $record will 
be empty, or at least won't contain any subheader or bodytext.

I've solved it with setting TYPO3_CONF_VARS['FE']['secureFormmail'] to 
false (NOT good, dangerous).

But then the code in the other part of the if-else sets recipient from 
$EMAIL_VARS, which means that I have to define hidden input like that:

plugin.tx_productsmail_pi1.mailform.dataArray.200.value = info at example.com
plugin.tx_productsmail_pi1.mailform.dataArray.200.type = recipient=hidden

although the recipient is already set. I don't like that recipient is in 
fact a hidden field.

Any ideas how to do this the right way?

Thanks

-- 
Jan Bednarik
www.bednarik.org - web about Typo3 in czech


More information about the TYPO3-english mailing list