[TYPO3-commerce] Problem with Clients mail and Admin mails

Siddhesh siddesh.savant at lelesys.com
Mon Mar 28 12:52:58 CEST 2011


On Monday 28 March 2011 03:33 PM, Daniel Herfen wrote:
> Hi Siddhesh
>
> for me the sendmail funtion in lib/class.tx_commerce_div.php is now like
> this:
>
>
> function sendMail($mailconf) {
>
> $mailconf['recipient'] =
> tx_commerce_div::validEmailList($mailconf['recipient']);
> if ($mailconf['recipient']) {
>
> $hookObjectsArr = array();
> if (is_array
> ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_div.php']['sendMail']))
> {
> foreach
> ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_div.php']['sendMail']
> as $classRef) {
> $hookObjectsArr[] = &t3lib_div::getUserObj($classRef);
> }
> }
>
> if ($mailconf['additionalData']) {
> $additionalData = $mailconf['additionalData'];
> }
>
> foreach($hookObjectsArr as $hookObj) {
> /**
> * @depricated: This Hook is depricated
> */
> if (method_exists($hookObj, 'preProcessHtmlMail')) {
> $mail=$hookObj->preProcessHtmlMail($mailconf);
> }
>
> /**
> * this is the current hook
> */
> if (method_exists($hookObj, 'preProcessMail')) {
> $hookObj->preProcessMail($mailconf,$additionalData);
> }
> }
>
> foreach($hookObjectsArr as $hookObj) {
> if (method_exists($hookObj, 'ownMailRendering')) {
> $this->hookObjectsArr = $hookObjectsArr;
> return $hookObj->ownMailRendering($mailconf,$additionalData,$this);
> }
> }
>
> $mail = t3lib_div::makeInstance('t3lib_mail_Message');
>
> $namefrom = $mailconf['fromName'];
> $namefrom = $mailconf['fromName'];
> $emailfrom = tx_commerce_div::validEmailList($mailconf['fromEmail']);
>
> $mail->setFrom(array($emailfrom => $namefrom));
>
>
> $emailto = tx_commerce_div::validEmailList($mailconf['recipient']);
>
> $mail->setTo(array($emailto => $emailto));
>
>
> $parts = explode('<title>|</title>', $mailconf['html']['content'], 3);
> if (trim($parts[1])) {
> $subject = strip_tags(trim($parts[1]));
> }elseif( $mailconf['plain']['subject']){
> $subject = $mailconf['plain']['subject'];
> }else{
> $subject = $mailconf['alternateSubject'];
> }
>
> $mail->setSubject($subject);
>
> $htmlcontent = $mailconf['html']['content']:
> $plaincontent = $mailconf['plain']['content'];
>
> if($mailconf['html']['useHtml'] == '1'){
> $mail->setBody($htmlcontent, 'text/html');
> }else{
> $mail->addPart($plaincontent, 'text/plain');
>
> }
>
> if (is_array($mailconf['attach'])) {
> foreach($mailconf['attach'] as $file) {
> if ($file && file_exists($file)) {
> $mail->attach(Swift_Attachment::fromPath($file));
> }
> }
> }
>
> foreach($hookObjectsArr as $hookObj) {
> if (method_exists($hookObj, 'postProcessMail')) {
>
> $mail=$hookObj->postProcessMail($mail,$mailconf,$additionalData);
> }
> }
>
> $mail->send();
> return true;
> }
> return false;
> }
>
>
> hope this works for you as well.
>
> maybe someone can have a look at this, because of security and correct
> coding guidlines.
>
> greatings
> Daniel
>
>
> Am 26.03.11 08:12, schrieb Siddhesh:
>  > Hello Daniel,
>  > Can you give me the mail function you have written.I think the older
>  > mail function does not work...
>  >
>  > Thanks in Advance
>
>
>> On Friday 25 March 2011 07:37 PM, Daniel Herfen wrote:
>>> Hi everyone
>>>
>>> have a look at this page (it's in german):
>>>
>>> http://www.typo3forum.net/forum/commerce/51009-commerce-svn-0-12-4-typo3-4-5-2-depraciated-functions.html
>>>
>>>
>>>
>>>
>>> i tried to rewirte the sendMail() function in
>>> lib/class.tx_commerce_div.php
>>>
>>> for me it works.
>>>
>>> But I don't know if there are some security issues or if it's a good way
>>> to rewrite it like this.
>>>
>>>
>>> Sorry for my poor english and I hope i'm doing everything right here.
>>> I'm new to this kind of maillinglists.
>>>
>>> Greatings
>>> Daniel
>>>
>>>
>>>
>>> Am 23.03.11 14:31, schrieb Georg Schönweger:
>>>> I don't know if somebody is working on this.
>>>> You should check if there is a bug entry on forge.typo3.org and if not
>>>> then create one.
>>>>
>>>> - Georg
>>>>
>>>> Am 23.03.2011 10:03, schrieb Dimitri Kšoenig:
>>>>> Hi Georg
>>>>>
>>>>> I've tried it again and now it works. Don't ask me why. And yes, i've
>>>>> deleted all the caches :-)
>>>>>
>>>>> BTW: Is anyone working on fixing this bug properly?
>>>>>
>>>>> Cheers
>>>>> Dimitri
>>>>>
>>>>> Georg Schönweger schrieb:
>>>>>> Hi Dimitri,
>>>>>>
>>>>>> t3lib_htmlmail is using t3lib_utility_mail::Mail(), so setting
>>>>>> $TYPO3_CONF_VARS['MAIL']['substituteOldMailAPI'] = '0';
>>>>>> affects also the output of mails from commerce extension.
>>>>>>
>>>>>> Atleast with above solution it is working here with Typo3 4.5
>>>>>>
>>>>>> - Georg
>>>>>>
>>>>>> Am 22.03.2011 18:02, schrieb Dimitri Kšoenig:
>>>>>>> Hi Georg
>>>>>>>
>>>>>>> commerce_div:sendMail is the function used in commerce_pi3 to send
>>>>>>> user and admin mails. it uses an instance of t3lib_htmlmail so that
>>>>>>> won't work. Do you have any other solutions?
>>>>>>>
>>>>>>> Cheers
>>>>>>> Dimitri
>>>>>>>
>>>>>>> Georg Schönweger schrieb:
>>>>>>>> Hi Siddesh,
>>>>>>>>
>>>>>>>> You have to disable "substituteOldMailAPI" in typo3conf.php with
>>>>>>>> $TYPO3_CONF_VARS['MAIL']['substituteOldMailAPI'] = '0';
>>>>>>>> or via the InstallTool.
>>>>>>>> Helptext for this option:
>>>>>>>> "If this is set, old calls to t3lib_utility_mail::Mail() will be
>>>>>>>> translated to new t3lib_mail calls. This should work on most cases
>>>>>>>> and
>>>>>>>> thus respect the above transport settings. If you get garbled
>>>>>>>> emails (or
>>>>>>>> no attachments), consider setting this off. Ask the extension
>>>>>>>> author to
>>>>>>>> upgrade their code to make use of t3lib_mail (instead of the
>>>>>>>> deprecated
>>>>>>>> t3lib_htmlmail)."
>>>>>>>>
>>>>>>>> - Georg
>>>>>>>>
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> TYPO3-project-commerce mailing list
>>>>>>> TYPO3-project-commerce at lists.typo3.org
>>>>>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-commerce
>>>>>>>
>>>>>>>
>>>>> _______________________________________________
>>>>> TYPO3-project-commerce mailing list
>>>>> TYPO3-project-commerce at lists.typo3.org
>>>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-commerce
>>>
>> Hello Daniel,
>> Can you give me the mail function you have written.I think the older
>> mail function does not work...
>>
>> Thanks in Advance
>
Hi Daniel,
I went through your code,i guess u had made many changes to your send 
mail function.I dont have any idea whether it is secure or not.

Thanks


More information about the TYPO3-project-commerce mailing list