2

In the Magento backend I can set the email addresses used to contact customers in the following place: System -> Configuration -> GENERAL -> Store Email Addresses. How these configured email addresses are used can be further configured under ystem -> Configuration -> SALES -> Sales Emails, for instance, although the defaults are generally fine.

What I don't understand is, under System -> Configuration -> CUSTOMERS -> Customer Configuration -> Create New Account Options, there is an entry under Create New Account Options entitled:

"Default Email Domain"

What is this? After all, the store has its own emails as pointed out above, and each registering customer will have their own email, so whose default is this? After all, as far as I understand it, no store is going to offer customers email adresses under an "email domain", so what the heck is this entry all about? I'm puzzled.

Thanks a lot.

1 Answer 1

6

Did some digging for this one and it is only used once in method _getNewCustomerEmail in the class Mage_Adminhtml_Model_Sales_Order_Create.

Here it is joined with the customer increment ID to create an email address address in case there isn't an email address set. So basically if you fill out foobar.com in the backend the email adress would be something like [email protected]

Now as to why it does this. It is used in several method of which only the method _prepareCustomer isn't deprecated (one is even deprecated after version 1.1 something). Right at the start of this method it's checked if the customer isn't a guest customer so my best guess is that this method is used to create a new user account from the checkout and the email address is set temporarily to prevent data validation errors while processing the new account and/or order. The following piece of code is actually using the dummy email

[...]
// Prepare new customer
/** @var $customerBillingAddress Mage_Customer_Model_Address */
$customerBillingAddress = $this->getBillingAddress()->exportCustomerAddress();
$customer->addData($customerBillingAddress->getData())
   ->setPassword($customer->generatePassword())
   ->setStore($store);
$customer->setEmail($this->_getNewCustomerEmail($customer));
$this->_setCustomerData($customer);
[...]

Now what the exact reason is I wouldn't be able to say, nor if this email address is actually ever used anywhere else in the system. Looking at the amount of deprecated code in this class it could very well be a relic from a much older Magento version.

I would suggest setting it either to the webshops domain or to some dummy domain like example.com

2
  • So basically it is a useless placeholder used to fill out the domain portion of an email address in the case where the customer did not provide one and the database needs to have a value in place? Still, it makes absolutely no sense to me. Perhaps Magento ought to remove that field from their 1.8.0.0 release. So should I just leave it as example.com, or is it better to change it to the web shop's domain. What difference is it going to make? Thanks. Oct 16, 2013 at 22:14
  • 1
    I learn something new everyday. Nice digging.
    – Marius
    Jul 23, 2014 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.