<p>Best way to do this would be creating a small plugin (recommended on every Commerce install, to be able to easily extend it). In this plugin's init method, you could listen to the OrderComplete event and send the mail. This is untested, but should get you started:</p>

<pre><code>public function init()
{
    craft()-&gt;on('commerce_orders.onOrderComplete', function($event) {
        $order = $event-&gt;params['order'];
        $note = $order-&gt;getContent()-&gt;shippingNoteFieldHandle;

        if ($note) {
            //Send Mail
            $email = new EmailModel();
            $email-&gt;toEmail = 'address@tospam.com';
            $email-&gt;subject = 'New order completed';
            $email-&gt;body    = $note;

            craft()-&gt;email-&gt;sendEmail($email);
        }
    });
}
</code></pre>

<p>You can use <a href="https://pluginfactory.io/" rel="nofollow">pluginfactory.io</a> to quickly create a plugin, then put the init method in the plugin's base class.</p>

CC BY-SA 3.0
2016-07-06T18:17:17.630Z
2016-07-06T18:17:17.630Z
Paul
<p>Is there anyway to send a custom field by email? For example if a customer were to enter a shipping note and submits an order is there a way to send that note to an email address?</p>

<plugin-craftcommerce>
Send a custom field by email
# Send a custom field by email

(Asked by: username_0 on 2016-07-06)

Is there anyway to send a custom field by email? For example if a customer were to enter a shipping note and submits an order is there a way to send that note to an email address?

**Tags:** plugin-craftcommerce


---

## 1 answers

### Answer by username_1 on 2016-07-06. Score: 2 | Accepted answer

Best way to do this would be creating a small plugin (recommended on every Commerce install, to be able to easily extend it). In this plugin's init method, you could listen to the OrderComplete event and send the mail. This is untested, but should get you started:
public function init()
{
    craft()->on('commerce_orders.onOrderComplete', function($event) {
        $order = $event->params['order'];
        $note = $order->getContent()->shippingNoteFieldHandle;

        if ($note) {
            //Send Mail
            $email = new EmailModel();
            $email->toEmail = 'address@tospam.com';
            $email->subject = 'New order completed';
            $email->body    = $note;

            craft()->email->sendEmail($email);
        }
    });
}

You can use pluginfactory.io to quickly create a plugin, then put the init method in the plugin's base class.


---

