---
title: "EXT: \"Save Form Mail\""
url: "https://www.typo3.net/d/13012-ext-save-form-mail"
source: "typo3.net"
tags: ["Extensions","Frage"]
created: "2004-06-30"
last_reply: "2004-09-02"
replies: 5
solved: false
page: 1
pages: 1
lang: "de"
---

# EXT: "Save Form Mail"

Extensions · 5 Antworten · gestartet 2004-06-30

## Eröffnungsbeitrag

**cu6e** · 2004-06-30 · [Beitrag #1](https://www.typo3.net/d/13012-ext-save-form-mail/1)

hallo leute,

ich habe "Save Form Mail" installiert und habe jetzt ein Problem. Nach dem Absenden von einen Formular
bdekomme ich folgende ausgabe:

```plaintext
reserved_names .= ",quoted-printable"; if(is_array($V)) { t3lib_div::stripSlashesOnArray($V); } if(!isset($V["quoted-printable"])) { $base64 = TRUE; } else { if($V["quoted-printable"] == "1") { $base64 = FALSE; } else { $base64 = TRUE; } } // // derjoerg: End of extension: jr_qp_form_mail // //calling parent::start so everything is at first done as usual parent::start($V,$base64); //debug($V); //lookin for locationData t3lib_div::GPVar("locationData") ? $this->sfmLocationData = explode(":",t3lib_div::GPVar("locationData")) : $this->sfmLocationData[0]=$GLOBALS["TSFE"]->id; $this->sfmPid=$this->sfmLocationData[0]; //saving indata $this->sfmInData = $V; //these fields are saved in the datatable so they dont have to be saved in the fieldstable again: $this->sfmFieldsInDataTable=array("html_enabled"=>1, "subject"=>1, "recipient"=>1); //getting the formdefinition as basis for dynamic TCA (if this will ever work ;-) //and the inserts for MM-Rows in _fields $this->sfmFormTS = $this->sfmGetFormTS($this->sfmPid); //is the mail base64 encoded? $isBase64 = $this->alt_base64?'1':'0'; //the mail that was actually sent $mailtype = $V["html_enabled"]?"html":"plain"; $sentBody = $isBase64 ? base64_decode($this->theParts[$mailtype]["content"]) : $this->theParts[$mailtype]["content"]; //dont know whatfor right now but just to have it: the array that contains the various mailparts $sentParts = serialize($this->theParts); $now = time(); //if a storagepid is given, save data there else save it on current page: $this->sfmPid = $this->sfmStoragePid ? $this->sfmStoragePid : $this->sfmPid; $sql = "insert into tx_pksaveformmail_data (pid, tstamp, crdate, subject, recipient, sentbody, sentBodySerialized, TCABase, sentbody_base64encoded) values (".$this->sfmPid.", '".$now."', '".$now."', '".addslashes($this->subject)."', '".addslashes($this->recipient)."', '".addslashes($sentBody)."', '".addslashes($sentParts)."', '".addslashes(serialize($this->sfmFormTS["sfmTCAbase"]))."', ".$isBase64.")"; $res = mysql(TYPO3_db,$sql); if(mysql_error()) echo mysql_error()."
$sql
";; $dataFieldsRelation = mysql_insert_id(); if(is_array($this->sfmFormTS["insertRows"])){ while(list(,$data)=each($this->sfmFormTS["insertRows"])){ mysql(TYPO3_db,"insert into tx_pksaveformmail_fields (pid, tstamp, crdate, email_uid, field_type, field_name, field_value) values (".$this->sfmPid.", '".$now."', '".$now."', ".$dataFieldsRelation.", '".addslashes($data["field_type"])."', '".addslashes($data["field_name"])."', '".addslashes($data["field_value"])."')"); echo mysql_error(); } } } function sfmGetFormTS($pid){ //muss ich hier immer in die db schaun oder ist das evtl schon bekannt - dont know so just doing it => wishlist if(!$this->sfmPid) return; $sql = "select bodytext, tx_pksaveformmail_savetopid from tt_content where pid = ".$this->sfmPid." and hidden = 0 and deleted = 0 and ctype = 'mailform'"; if($GLOBALS["TSFE"]->config["config"]["sys_language_uid"]) $sql .= " and sys_language_uid = ".$GLOBALS["TSFE"]->config["config"]["sys_language_uid"]; $res = mysql(TYPO3_db,$sql); //könnten auch zwei forms auf einer seite sein, dann gegen $V checken welches das richtige ist... => wishlist //meanwhile //while($row=mysql_fetch_assoc($res)){ $row=mysql_fetch_assoc($res); $ta = explode("
",$row["bodytext"]); $sfmTCAbase = $this->sfmGetTCABase($ta); //} //saving the storagepid if there is one: $this->sfmStoragePid = $row["tx_pksaveformmail_savetopid"]; return $sfmTCAbase; } function sfmGetTCABase($dataArr){ $attachmentCounter=""; $hiddenfields=""; $fieldlist=Array(); $propertyOverride = Array(); $fieldname_hashArray = Array(); $cc=0; reset($dataArr); while(list(,$val)=each($dataArr)) { $cc++; $confData=Array(); if (is_array($formData)) { $parts = $val; $val=1; // true... } else { $val=trim($val); $parts = explode("|",$val); } if ($val && strcspn($val,"#/")) { // label: $confData["label"] = trim($parts[0]); // field: $fParts = explode(",",$parts[1]); $fParts[0]=trim($fParts[0]); if (substr($fParts[0],0,1)=="*") { $confData["required"]=1; $fParts[0] = substr($fParts[0],1); } $typeParts = explode("=",$fParts[0]); $confData["type"] = trim(strtolower(end($typeParts))); if (count($typeParts)==1) { $confData["fieldname"] = substr(ereg_replace("[^a-zA-Z0-9_]","",str_replace(" ","_",trim($parts[0]))),0,30); if (strtolower(ereg_replace("[^[:alnum:]]","",$confData["fieldname"]))=="email") {$confData["fieldname"]="email";} // Duplicate fieldnames resolved if (isset($fieldname_hashArray[md5($confData["fieldname"])])) { $confData["fieldname"].="_".$cc; } $fieldname_hashArray[md5($confData["fieldname"])]=$confData["fieldname"]; // Attachment names... if ($confData["type"]=="file") { $confData["fieldname"]="attachment".$attachmentCounter; $attachmentCounter=intval($attachmentCounter)+1; } } else { $confData["fieldname"] = str_replace(" ","_",trim($typeParts[0])); } $fieldCode=""; // Additional parameters if (trim($confData["type"])) { $addParams=trim($conf["params"]); if (is_array($conf["params."]) && isset($conf["params."][$confData["type"]])) { $addParams=trim($conf["params."][$confData["type"]]); } if (strcmp("",$addParams)) $addParams=" ".$addParams; } else $addParams=""; switch($confData["type"]) { case"textarea": $cols=trim($fParts[1]) ? intval($fParts[1]) : 20; $compWidth = doubleval($conf["compensateFieldWidth"] ? $conf["compensateFieldWidth"] : $GLOBALS["TSFE"]->compensateFieldWidth); $compWidth = $compWidth ? $compWidth : 1; $cols = t3lib_div::intInRange($cols*$compWidth, 1, 120); $rows=trim($fParts[2]) ? t3lib_div::intInRange($fParts[2],1,30) : 5; $wrap=trim($fParts[3]) ? ' wrap="'.trim($fParts[3]).'"' : ' wrap="VIRTUAL"'; // $default = $this->getFieldDefaultValue($conf["noValueInsert"], $confData["fieldname"], trim($parts[2])); $default = trim($parts[2]); $fieldCode=sprintf('%s', $confData["fieldname"], $cols, $rows, $wrap, t3lib_div::formatForTextarea($default)); break; case"input": case"password": $size=trim($fParts[1]) ? intval($fParts[1]) : 20; $compWidth = doubleval($conf["compensateFieldWidth"] ? $conf["compensateFieldWidth"] : $GLOBALS["TSFE"]->compensateFieldWidth); $compWidth = $compWidth ? $compWidth : 1; $size = t3lib_div::intInRange($size*$compWidth, 1, 120); // $default = $this->getFieldDefaultValue($conf["noValueInsert"], $confData["fieldname"], trim($parts[2])); $default = trim($parts[2]); if ($confData["type"]=="password") { $default=""; } $max=trim($fParts[2]) ? ' maxlength="'.t3lib_div::intInRange($fParts[2],1,1000).'"' : ""; $theType = $confData["type"]=="input" ? "text" : "password"; $fieldCode=sprintf('', $confData["fieldname"], $size, $max, htmlspecialchars($default)); break; case"file": $size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,60) : 20; $fieldCode=sprintf('', $confData["fieldname"], $size); break; case"check": // alternative default value: // $default = $this->getFieldDefaultValue($conf["noValueInsert"], $confData["fieldname"], trim($parts[2])); $checked = $default ? " checked" : ""; $fieldCode=sprintf('', 1, $confData["fieldname"], $checked); break; case"select": $option=""; $valueParts = explode(",",$parts[2]); // size if (strtolower(trim($fParts[1]))=="auto") {$fParts[1]=count($valueParts);} // Auto size set here. Max 20 $size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,20) : 1; // multiple $multiple = strtolower(trim($fParts[2]))=="m" ? " multiple" : ""; $items=array(); // Where the items will be $defaults=array(); //RTF for($a=0;$a'.trim($items[$a][0]).''; //RTF } if ($multiple) $confData["fieldname"].="[]"; // The fieldname must be prepended "[]" if multiple select. And the reason why it's prepended is, because the required-field list later must also have [] prepended. $fieldCode=sprintf('%s', $confData["fieldname"], $size, $multiple, $option); //RTF $confData["items"]=$items; break; case"radio": $option=""; $valueParts = explode(",",$parts[2]); $items=array(); // Where the items will be $default=""; for($a=0;$a'; // $option.= $this->stdWrap(trim($items[$a][0]), $conf["radioWrap."]); $option.= "
"; } $fieldCode=$option; $confData["items"]=$items; break; case "hidden": $value=trim($parts[2]); $hiddenfields.=sprintf('', $confData["fieldname"], $value); break; case "property": if (t3lib_div::inList("type,locationData,goodMess,badMess",$confData["fieldname"])) { $value=trim($parts[2]); $propertyOverride[$confData["fieldname"]] = $value; $conf[$confData["fieldname"]] = $value; } break; case "submit": $value=trim($parts[2]); if ($conf["image."]) { $this->data[$this->currentValKey]=$value; $image=$this->IMAGE($conf["image."]); } else $image=""; if($image) { $fieldCode = str_replace('', $confData["fieldname"], $value); } break; default: $confData["type"]="comment"; $fieldCode=trim($parts[2])." "; break; } } //required field found but no value in $V (incoming data) //this will never be the case so we didnt found the right //formsetdefinition - exit //debug($confData); if($confData["required"] && !$this->sfmInData[$confData["fieldname"]]) return false; if($confData && !$this->sfmFieldsInDataTable[$confData["fieldname"]]){ $sfmTCAbase[]=$confData; if($this->sfmInData[$confData["fieldname"]])$insertRows[] = array("field_type" => $confData["type"], "field_name" => $confData["fieldname"], "field_value" => $this->sfmInData[$confData["fieldname"]]); } } $out["sfmTCAbase"]=$sfmTCAbase; $out["insertRows"]=$insertRows; return $out; } } ?>
```

Die Daten werden als Mail versendet, landen aber nicht in der DB.

Hat jemand eine Idee, ich habe schon den ganzen Tag gestern gesucht, leider nichts gefunden.

DANKE für alles Tipps!
Habe typo3 3.6.1 im Einsatz.

## Antworten

### [#2](https://www.typo3.net/d/13012-ext-save-form-mail/2) · emueller · 2004-06-30

Du musst im Formular auch die Speicherseite angeben!

### [#3](https://www.typo3.net/d/13012-ext-save-form-mail/3) · cu6e · 2004-06-30

unter Storagepage habe ich eine Seite stehen, wo die Mails gespeichert werden sollen.
Es ändert nichts an der Ausgabe. Die Daten werden weiterhin nicht gespeichert.  :(

### [#4](https://www.typo3.net/d/13012-ext-save-form-mail/4) · freeman2000 · 2004-08-08

Hi,

das gleiche Problem hatte ich auch. Bei mir ist der Server so konfiguriert, dass der PHP-Script-Bereich unbedingt mit

```php
<?php
```

beginnen muss. In der Datei "class.ux_t3lib_formmail.php" fehlt aber das "php" nach

```plaintext
<?
```

Deswegen wird die Datei nicht geparst und nur als Text ausgegeben.

Ich habe also nur das "php" angehänt und die Extension lief.

Viele Grüße,
Olli

### [#5](https://www.typo3.net/d/13012-ext-save-form-mail/5) · cu6e · 2004-08-09

danke, werde ich versuchen

### [#6](https://www.typo3.net/d/13012-ext-save-form-mail/6) · hopfi73 · 2004-09-02

> **freeman2000 schrieb:**
>
> Hi,
>
> das gleiche Problem hatte ich auch. Bei mir ist der Server so konfiguriert, dass der PHP-Script-Bereich unbedingt mit
>
> ```php
> <?php
> ```
>
> beginnen muss. In der Datei "class.ux_t3lib_formmail.php" fehlt aber das "php" nach
>
> ```plaintext
> <?
> ```
>
> Deswegen wird die Datei nicht geparst und nur als Text ausgegeben.
>
> Ich habe also nur das "php" angehänt und die Extension lief.
>
> Viele Grüße,
> Olli

Danke, hat bei mir funktioniert!!

Lg

---

Quelle: „EXT: "Save Form Mail"“, typo3.net, https://www.typo3.net/d/13012-ext-save-form-mail
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
