Magento – Backend: Reason for duplicate? “Default Email Domain” configuration option

backendconfigurationemail

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.

Best Answer

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 1000000001@foobar.com

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

Related Topic