error with an incorrect email format

  • Posts: 583
  • Thank you received: 22
  • Hikaserial Subscription Hikashop Multisite
4 years 5 months ago #312303

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.12
-- PHP version -- : 7.3

Hi,

When you have a free product (like a workshop) and a customer choose for a guest checkout and don't use a valid email format,
then you wil get an error and no decent notification. After that error the order is also confirmed and the shop owner don't get any e-mail from this order.



Can you please take a look at this issue.

We have tested this in version 4.2.1 and 4.2.2

Kind regards,
Lumiga


Kind regards,
Lumiga
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
4 years 5 months ago #312310

Hi,

Well, that's not really true.
HikaShop does check for the validity of the email address format.
It acutally uses the function JMailHelper::isEmailAddress from the Joomla library.
And not having a dot in the domain name area of an email address is not invalid:
stackoverflow.com/questions/20573488/why...emails-without-a-dot
So Joomla tells HikaShop that the email address format is valid (which it is).
And then, HikaShop uses Joomla's email library to send the email for the order creation which apparently fails on your website because the email address is invalid based on PHPMailer's library used by Joomla's library.
So the problem is that there is an inconsistency between the check done by Joomla and the check done by PHPMailer.

The solution we're going to go with is to change the line:

			if(empty($registerData->email) || (method_exists('JMailHelper', 'isEmailAddress') && !JMailHelper::isEmailAddress($registerData->email))){
to:
			$mailer = JFactory::getMailer();
			if(empty($registerData->email) || (method_exists('JMailHelper', 'isEmailAddress') && !JMailHelper::isEmailAddress($registerData->email)) || !$mailer->validateAddress($registerData->email)){
in the file administrator/components/com_hikashop/classes/user.php
That way both the validaty check from Joomla and the one from PHPMailer will be enforced when the guest form is checking the email address so as to provide a proper error message at that point.

The following user(s) said Thank You: Lumiga

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum