Bei mir ist jetzt alles top, bis auf die Mail an den Anbieter.
Hier der Code aus der Datei CatalogPowerMailer.php :
PHP-Code:
<?php if (!defined('TL_ROOT')) die('You cannot access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright www.ena-webstudio.com 2011
* @author Nina Gerling <gerling@ena-webstudio.com>
* @package catalog_power_mailer
* @license LGPL
* @version $Id: $
* @filesource
*/
class CatalogPowerMailer extends Controller
{
public function sendTheMail($arrPost, $arrForm, $arrFiles)
{
if ($arrForm['formID'] == 'catalogform') // fill in your Form ID (form setting) -> NOT form CSS-ID!
{
$objMail = new Email();
$this->Import('Database');
$this->Import('Input');
/**
* Use form title as mail subject
*/
$objDbForm = $this->Database->prepare('SELECT * FROM tl_form WHERE id=?')
->limit(1)
->execute('18'); // fill in the record ID of your form
$objMail->subject = $objDbForm->title;
/**
* Choose which field of the form should be used as mail sender
*/
$objMail->from = $arrPost['absender']; // form field 'Absender'
/**
* Choose which fields of the form should be sent as mail text
* Join fields with: . "\n" .
*/
$objMail->text =
$arrPost['einleitung'] . "\n" . // form field 'einleitung'
$arrPost['name'] . "\n" . // form field 'Name'
$arrPost['telefon'] . "\n" . // form field 'Telefon'
$arrPost['absender'] . "\n" . // form field 'Absender'
$arrPost['anzeigentitel'] . "\n" . // form field 'Absender'
$arrPost['nachricht']. "\n" . // form field 'Mitteilung'
$arrPost['link']. "\n" . // form field 'Link'
$arrPost['abschluss']; // form field 'abschluss'
/**
* Use email-field of the active catalog item as mail recipient
* Send mail as soon as it hits the sendTo() command
*/
$objDbCatalog = $this->Database->prepare('SELECT * FROM marktplatz WHERE alias=?') // fill in catalog-table name
->limit(1)
->execute($this->Input->get('items'));
$objMail->sendTo($objDbCatalog->email);
}
}
}
?>
Was muss ich jetzt wo ergänzen, dass ich eine Einleitung (Lieber Nutzer, sie haben eine neue Anfrage auf...) und ein Abschlusssatz + Impressum zu jeder Mail hinzukommt?
Danke
Grüße
Matu
Lesezeichen