Project

General

Profile

Actions

Bug #30411

closed

Mailapi - Validation error

Added by Kay Strobach about 13 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2011-09-29
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Some mailadresses let show up validation errors, even if they are valid:

Examples:

- 
-
-

Exact adresses can be send to someone personally - but are not expected to be public ;)

Solutions:
- a) make it configurable, that the error just goes to the logfiles
- b) make it possible to use any mailadress which is possible through the RFC (even @localhost, or @otherhost)

This problem was introduced with the swiftmailer ;) - which is nice anyway

Regards
Kay

Actions #1

Updated by Kay Strobach about 13 years ago

additional problematic adresses:

- 
Actions #2

Updated by Peter Niederlag about 13 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (4.5.7)

Can you please provide more details:

  • Where and how the mail is generated?
  • what is the validation error shown?
  • what address you have problems with?
Actions #3

Updated by Kay Strobach about 13 years ago

hi,

the mail is generated in 2 different plugins, with the same error:

1. powermail:
http://www3.sn.schule.de/sbs/services/werkzeuge/service-beantragen/

2. a news submitter extension:
http://www3.sn.schule.de/sbs/startseite/aktuelles/eigener-eintrag/

Regards
Kay

Actions #4

Updated by Jigal van Hemert about 13 years ago

A couple of questions:

1. Is it a recent version of PowerMail which has native support for the new mail API?

2. Does the "news submitter extension" has native support for the new mail API, or does it use t3lib_htmlMail?

3. Does the problem occur for email addresses of the sender? If SMTP is used as transport many SMTP servers will refuse certain (in their opinion invalid) email addresses.

Actions #5

Updated by Kay Strobach about 13 years ago

Hi i post the sourcecode for the submitter here - no it no native support for the swiftmailer - it uses htmlmail api.

I use the latest powermail form ter.

<?php
/***************************************************************
*  Copyright notice
*
*  (c) 2010 -- <--@www.sn.schule.de>
*  All rights reserved
*
*  This script is part of the TYPO3 project. The TYPO3 project is
*  free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*
*  This script 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 General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
 * [CLASS/FUNCTION INDEX of SCRIPT]
 *
 * Hint: use extdeveval to insert/update function index above.
 */

require_once(PATH_tslib.'class.tslib_pibase.php');

/**
 * Plugin 'tt_news_fesubmit' for the 'ks_news_fesubmit' extension.
 *
 * @author    -- <--@www.sn.schule.de>
 * @package    TYPO3
 * @subpackage    tx_ksnewsfesubmit
 */
class tx_ksnewsfesubmit_pi1 extends tslib_pibase {
    var $prefixId      = 'tx_ksnewsfesubmit_pi1';        // Same as class name
    var $scriptRelPath = 'pi1/class.tx_ksnewsfesubmit_pi1.php';    // Path to this script relative to the extension dir.
    var $extKey        = 'ks_news_fesubmit';    // The extension key.

    /**
     * Wandelt das Flexform in ein eindimensinales Array
     *
     */              
    function pi_flexMakeNice() {
        $index      = $GLOBALS['TSFE']->sys_language_uid;
        $piFlexForm = $this->cObj->data['pi_flexform']; 
        $sDef       = current($piFlexForm['data']);
        $lDef       = array_keys($sDef);

        foreach ($piFlexForm['data'] as $sheet => $data ) {
            foreach ($data[$lDef[$index]] as $key => $val ) {
                $this->lConf[$key] = $this->pi_getFFvalue($piFlexForm, $key, $sheet,$lDef[$index]);
            }
        }
    }

    /**
     * The main method of the PlugIn
     *
     * @param    string        $content: The PlugIn content
     * @param    array        $conf: The PlugIn configuration
     * @return    The content that is displayed on the website
     */
    function main($content, $conf) {
        $this->conf = $conf;
        $this->pi_setPiVarDefaults();
        $this->pi_loadLL();
        $this->pi_USER_INT_obj = 1;    // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
        $this->pi_initPIflexForm();
        $this->pi_flexMakeNice();

        //lade extjs für den editor ... ;)
        $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
        $pageRenderer->loadExtJS();

        //load template

        if($this->lConf['template']) {
            $this->tmpl = $this->cObj->fileResource($this->lConf['template']);
        }else {
            $this->tmpl = $this->cObj->fileResource('EXT:ks_news_fesubmit/pi1/template.html');
        }

        if(t3lib_div::_POST('save')) {
            $content.=$this->processForm();
        } else {
            $content.=$this->showForm();
        }

        return $this->pi_wrapInBaseClass($content);
    }
    function showForm() {
        $tmpl = $this->cObj->getSubpart($this->tmpl,'###FORM###');
        return $tmpl;
    }
    function processForm() {
        $tmpl     = $this->cObj->getSubpart($this->tmpl,'###FORM###');
        $errTmpl  = $this->cObj->getSubpart($this->tmpl,'###ERRORS###');
        $okTmpl   = $this->cObj->getSubpart($this->tmpl,'###OK###');
        $tfields   = array(
            'honey'        => t3lib_div::_POST('honey'),
            'title'        => t3lib_div::_POST('title'),
            'bodytext'     => t3lib_div::_POST('bodytext'),
            'urlcaption'   => t3lib_div::_POST('urlcaption'),
            'links'        => t3lib_div::_POST('url'),
            'image'        => t3lib_div::_POST('graphic'),
            'graphictext'  => t3lib_div::_POST('graphictext'),
            'attachment'   => t3lib_div::_POST('attachment'),
            'author'       => t3lib_div::_POST('name'),
            'author_email' => t3lib_div::_POST('email'),
        );

        if(t3lib_div::_POST('honey')) {
            $error = 'Sry, but you submitted hidden fields - are you a bot?';
        }
        if(!t3lib_div::_POST('title')) {
            $error = 'Bitte Titel ausfüllen!';
        }
        if(!t3lib_div::_POST('bodytext')) {
            $error = 'Bitte Text ausfüllen!';
        }
        if(strlen(t3lib_div::_POST('bodytext'))<80) {
            $error = 'Bitte Text ausfüllen, 80 Zeichen sind Mindestlänge!';
        }
        if(!t3lib_div::_POST('name')) {
            $error = 'Bitte Name angeben!';
        }
        if(!t3lib_div::_POST('email')) {
            $error = 'Bitte E-Mail angeben!';
        }
        if(!t3lib_div::verifyFilenameAgainstDenyPattern($_FILES['graphic']['tmp_name'])) {
            $error = 'Die als Grafik eingebundene Datei ich nicht erlaubt!';
        }
        if(!t3lib_div::verifyFilenameAgainstDenyPattern($_FILES['attachment']['tmp_name'])) {
            $error = 'Die als Anhang eingebundene Datei ich nicht erlaubt!';
        }
        if($error) {
            return $this->cObj->substituteMarkerArrayCached($errTmpl,
                array(
                    '###ERROR###' => $error
                )
            );
        }
        //ermittle ausgangspunkt zum speichern
        $pid = intval($this->lConf['pages']);
        if($pid === 0) {
            $pid = intval($this->cObj->data['pid']);
        }        
        if($tfields['links']) {
            //$fields
        }
        if($_FILES['graphic']['error']===0) {
            $src  = $_FILES['graphic']['tmp_name'];
            $dest = 'uploads/pics/'.time().'-'.$_FILES['graphic']['name'];
            t3lib_div::upload_copy_move($src,$dest);
            $tfields['image'] = basename($dest);
        }
        if($_FILES['attachment']['error']===0) {
            $src  = $_FILES['attachment']['tmp_name'];
            $dest = 'uploads/media/'.time().'-'.$_FILES['attachment']['name'];
            t3lib_div::upload_copy_move($src,$dest);
            $tfields['attachment'] = basename($dest); 
        }
        unset($tfields['urlcaption']);
        unset($tfields['honey']);
        unset($tfields['graphic']);

        $fields = array(
            'pid'             => $pid,
            'title'           => strip_tags($tfields['title']),
            'datetime'        => time(),
            'crdate'          => time(),
            'tstamp'          => time(),
            'hidden'          => 1,
            'bodytext'        => strip_tags($tfields['bodytext']),
            'links'           => strip_tags($tfields['links']),
            'image'           => strip_tags($tfields['image']),
            'imagecaption'    => strip_tags($tfields['graphictext']),
            'imagealttext'    => strip_tags($tfields['graphictext']),
            'imagetitletext'  => strip_tags($tfields['graphictext']),
            'news_files'      => strip_tags($tfields['attachment']),
            'author'          => strip_tags($tfields['author']),
            'author_email'    => strip_tags($tfields['author_email'])
        );

        //die('fields are ok');

        $GLOBALS['TYPO3_DB']->exec_INSERTquery(
            'tt_news',
            $fields
        );

        if($this->lConf['emailsend']) {
            $mail = new t3lib_htmlmail();
            $mail->start();
            $rep_fields = array();
            foreach($fields as $key=>$val) {
                $rep_fields['###'.$key.'###'] = $val;
            }
            $rep_fields['###datetime###'] = date('r',$rep_fields['###datetime###']);
            $rep_fields['###host###']     = $__SERVER["HTTP_HOST"];
            $buffer = $this->cObj->getSubpart($this->tmpl,'###MAIL###');
            $buffer = $this->cObj->substituteMarkerArrayCached($buffer,$rep_fields);
            $mail->from_email = $fields['author_email'];
             $mail->from_name  = $fields['author'];
            $mail->setHTML($buffer);
            $mail->subject = $this->lConf['emailsubject'];
            $mail->send($this->lConf['emailadress']);
        }
        if($this->lConf['thankspage']!='') {
            header('Location: '.$GLOBALS['TSFE']->tmpl->setup['config.']['baseURL'].$this->pi_getPageLink($this->lConf['thankspage']));
        }
        //die(mysql_error());
        if($error) {
            return $okTmpl;
        }
    }
}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/ks_news_fesubmit/pi1/class.tx_ksnewsfesubmit_pi1.php'])    {
    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/ks_news_fesubmit/pi1/class.tx_ksnewsfesubmit_pi1.php']);
}

?>
Actions #6

Updated by Markus Klein about 13 years ago

What's your setting of [MAIL][substituteOldMailAPI] in the Installer?

If this is true, then the problem is should be in t3lib\mail\class.t3lib_mail_rfc822addressesparser.php.
What is the exact error message (and/or error number)?

Actions #7

Updated by Kay Strobach about 13 years ago

it's enabled.

sry, for late responding was heavily in progress of fixing things for 4.6 ;)

Actions #8

Updated by Kay Strobach about 13 years ago

[MAIL][substituteOldMailAPI] = 0 works like a charm :( - why do we have this buggy option ;), i need to disable it in ALL installations ...

Actions #9

Updated by Alexander Opitz over 11 years ago

  • Status changed from Needs Feedback to Closed
Actions

Also available in: Atom PDF