Loading modules/order/src/Mail/OrderReceiptMail.php +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class OrderReceiptMail implements OrderReceiptMailInterface { $params = [ 'id' => 'order_receipt', 'from' => $order->getStore()->getEmail(), 'from' => $order->getStore()->getEmailFromHeader(), 'bcc' => $bcc, 'order' => $order, ]; Loading modules/order/tests/src/Kernel/Mail/OrderReceiptMailTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ class OrderReceiptMailTest extends OrderKernelTestBase { $email = end($emails); $this->assertEquals('text/html; charset=UTF-8;', $email['headers']['Content-Type']); $this->assertEquals('8Bit', $email['headers']['Content-Transfer-Encoding']); $this->assertEquals($this->order->getStore()->getEmail(), $email['from']); $this->assertEquals($this->order->getStore()->getEmailFromHeader(), $email['from']); $this->assertEquals('customer@example.com', $email['to']); $this->assertFalse(isset($email['headers']['Bcc'])); $this->assertEquals('Order #2017/01 confirmed', $email['subject']); Loading @@ -130,7 +130,7 @@ class OrderReceiptMailTest extends OrderKernelTestBase { $email = end($emails); $this->assertEquals('text/html; charset=UTF-8;', $email['headers']['Content-Type']); $this->assertEquals('8Bit', $email['headers']['Content-Transfer-Encoding']); $this->assertEquals($this->order->getStore()->getEmail(), $email['from']); $this->assertEquals($this->order->getStore()->getEmailFromHeader(), $email['from']); $this->assertEquals('custom@example.com', $email['to']); $this->assertEquals('store@example.com', $email['headers']['Bcc']); $this->assertEquals('Order #2017/01 confirmed', $email['subject']); Loading modules/store/commerce_store.module +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ function commerce_store_mail_alter(&$message) { $current_store = \Drupal::service('commerce_store.current_store'); $current_store = $current_store->getStore(); if ($current_store) { $message['from'] = $current_store->getEmail(); $message['from'] = $current_store->getEmailFromHeader(); } } } Loading modules/store/src/Entity/Store.php +7 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,13 @@ class Store extends ContentEntityBase implements StoreInterface { return $this->get('mail')->value; } /** * {@inheritdoc} */ public function getEmailFromHeader() { return sprintf('%s <%s>', $this->getName(), $this->getEmail()); } /** * {@inheritdoc} */ Loading modules/store/src/Entity/StoreInterface.php +11 −1 Original line number Diff line number Diff line Loading @@ -35,10 +35,20 @@ interface StoreInterface extends ContentEntityInterface, EntityOwnerInterface, E * Gets the store email. * * @return string * The store email * The store email. */ public function getEmail(); /** * Gets the store email formatted as email 'From' header. * * Example: 'My Store <mystore@example.com>' * * @return string * The store name, with email wrapped in angle brackets. */ public function getEmailFromHeader(); /** * Sets the store email. * Loading Loading
modules/order/src/Mail/OrderReceiptMail.php +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class OrderReceiptMail implements OrderReceiptMailInterface { $params = [ 'id' => 'order_receipt', 'from' => $order->getStore()->getEmail(), 'from' => $order->getStore()->getEmailFromHeader(), 'bcc' => $bcc, 'order' => $order, ]; Loading
modules/order/tests/src/Kernel/Mail/OrderReceiptMailTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ class OrderReceiptMailTest extends OrderKernelTestBase { $email = end($emails); $this->assertEquals('text/html; charset=UTF-8;', $email['headers']['Content-Type']); $this->assertEquals('8Bit', $email['headers']['Content-Transfer-Encoding']); $this->assertEquals($this->order->getStore()->getEmail(), $email['from']); $this->assertEquals($this->order->getStore()->getEmailFromHeader(), $email['from']); $this->assertEquals('customer@example.com', $email['to']); $this->assertFalse(isset($email['headers']['Bcc'])); $this->assertEquals('Order #2017/01 confirmed', $email['subject']); Loading @@ -130,7 +130,7 @@ class OrderReceiptMailTest extends OrderKernelTestBase { $email = end($emails); $this->assertEquals('text/html; charset=UTF-8;', $email['headers']['Content-Type']); $this->assertEquals('8Bit', $email['headers']['Content-Transfer-Encoding']); $this->assertEquals($this->order->getStore()->getEmail(), $email['from']); $this->assertEquals($this->order->getStore()->getEmailFromHeader(), $email['from']); $this->assertEquals('custom@example.com', $email['to']); $this->assertEquals('store@example.com', $email['headers']['Bcc']); $this->assertEquals('Order #2017/01 confirmed', $email['subject']); Loading
modules/store/commerce_store.module +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ function commerce_store_mail_alter(&$message) { $current_store = \Drupal::service('commerce_store.current_store'); $current_store = $current_store->getStore(); if ($current_store) { $message['from'] = $current_store->getEmail(); $message['from'] = $current_store->getEmailFromHeader(); } } } Loading
modules/store/src/Entity/Store.php +7 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,13 @@ class Store extends ContentEntityBase implements StoreInterface { return $this->get('mail')->value; } /** * {@inheritdoc} */ public function getEmailFromHeader() { return sprintf('%s <%s>', $this->getName(), $this->getEmail()); } /** * {@inheritdoc} */ Loading
modules/store/src/Entity/StoreInterface.php +11 −1 Original line number Diff line number Diff line Loading @@ -35,10 +35,20 @@ interface StoreInterface extends ContentEntityInterface, EntityOwnerInterface, E * Gets the store email. * * @return string * The store email * The store email. */ public function getEmail(); /** * Gets the store email formatted as email 'From' header. * * Example: 'My Store <mystore@example.com>' * * @return string * The store name, with email wrapped in angle brackets. */ public function getEmailFromHeader(); /** * Sets the store email. * Loading