Jump to content

Error: mail parameters are corrupted


Xiao

Recommended Posts

Looking through the code it appears this text comes from the Mail class' send() method. So what seems to be happening is that some part of the code is attempting to generate an email message but the data being passed to it is invalid (either the template, subject or recipient). Presumably the product update happens before the message is sent which is why the update works.

Not sure why this is happening when you edit a product though. . .

Link to comment
Share on other sites

maybe because when i edit the quantity it tried to email the people who signed up to"notify my when product is available"?

anyway
how do i correct this error?

On my site everything is default expect the modules and i have edited the emails to change some things.
however i didn't get this error before

Link to comment
Share on other sites

Well, the easiest thing to do would be to temporarily edit classes/Mail.php to adjust the two sections where that error might be raised to include all parameters passed to try to tell what data is causing the issue (just search for the error message and you will see the two spots this occurs). Comment out the existing "die()" call and add one that includes the contents of all parameters. That should probably make it clear whether the issue is a bad config value, bad email data, etc.

The scenario you describe looks like it would be triggered here in "modules/mailalerts/mailalerts.php":


       public function hookUpdateQuantity($params)
       {
               $qty = intval($params['product']['quantity_attribute'] ? $params['product']['quantity_attribute'] : $params['product']['stock_quantity']) - intval($params['product']['quantity']);
               if ($qty <= intval(Configuration::get('PS_LAST_QTIES')) AND !(!$this->_merchant_oos OR empty($this->_merchant_mails)))
               {
                       $templateVars = array('{qty}' => $qty,
                       '{last_qty}' => intval(Configuration::get('PS_LAST_QTIES')),
                       '{product}' => strval($params['product']['name']));
                       Mail::Send(intval(Configuration::get('PS_LANG_DEFAULT')), 'productoutofstock', $this->l('Product out of stock'), $templateVars, explode(self::__MA_MAIL_DELIMITOR__, $this->_merchant_mails), NULL, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
               }
       }



So the Mail::Send() call above is passing something it shouldn't.

Cheers

Link to comment
Share on other sites

  • 3 months later...

I just got exactly the same issue.

I have two similar product pages to which I wanted to add an external link to a supplier's firmware update.
I added the link to the first product page then copied and pasted the link into the second page.
When I saved it, I got the "Error: mail parameters are corrupted" message but on checking, the link appears on the page o.k.
I then tried to edit the link and got the same error.
Deleted it altogether but still got the error.

There are no mail related tasks associated with this page but suspect something was corrupted in the copy and paste and is being interpreted somewhere in the code as a "mailto"

However, clicking on the link works fine.

Can anyone point me where to look to try and correct it?

Thanks
deepee

Link to comment
Share on other sites

  • 3 months later...

Hello,

This is what helped me when I had the same issue. I have the mailalerts module installed, and "notifications for customers when again in stock" activated. There was a corrupted entry in mailalerts table, having the product id, but 0 as custmer id and empty mail address. here is no customer with id 0 , so the mail address is empty, which will make the Mail function produce the error.

To fix it, I deleted the corrupted entries from the database (phpMyAdmin).

There is might be problem with mailalert that deleting customers does not delete their notifications, or the mail function should not be too trustful with the data and mail aonly if the mail address is not empty (mailalerts.php around line 256).

Hope this helps someone.

Link to comment
Share on other sites

Thanks for the update, agroth.

It prompted me to go back to the page I had the problem with, as I needed to update the external links.

These now resolve to a completely different address.

When I saved my changes, the page updated with no errors!

So it seems that my problem was due to an issue that the mailalert function had with the old link address.

Weird!

Cheers
deepee

Link to comment
Share on other sites

  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...