# Plugin - Shopware\_Modules\_Order\_SendMail\_BeforeSend

**URL:** https://forum.shopware.com/t/plugin-shopware-modules-order-sendmail-beforesend/10844
**Category:** Shopware 3.5
**Tags:** programming
**Created:** [8. Januar 2013 um 16:22 UTC](https://forum.shopware.com/t/plugin-shopware-modules-order-sendmail-beforesend/10844 "2013-01-08T16:22:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![fulltime](https://avatars.discourse-cdn.com/v4/letter/f/7ab992/32.png) [@fulltime](https://forum.shopware.com/u/fulltime)
#### Post date: [8. Januar 2013 um 16:22 UTC](https://forum.shopware.com/t/plugin-shopware-modules-order-sendmail-beforesend/10844/1 "2013-01-08T16:22:01Z")

</div>

Hi, bau gerade an mein Plugin rum und wollte gern das bei der Bestellmail noch ein Anhang hinzugefügt wird. Aktuell benutze ich das Event Shopware\_Modules\_Order\_SendMail\_BeforeSend. Leider habe ich aktuell 2 Probleme. Ich bentötige eine Zuordnung zu der Bestellung (ordernumber) und wie kann ich der Mail ein Anhang hinzufügen. Mein Aktueller Code ist wie folgt. ` public static function onSendMail(Enlight\_Event\_EventArgs $args) { $plugin = Shopware()-\>Plugins()-\>Frontend()-\>MeinPlugin(); $config = $plugin-\>Config(); $path = realpath(Shopware()-\>DocPath() . $config-\>uploadPath); $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); foreach ($objects as $name =\> $object) { $args-\>mail-\>addAttachment($name, basename($name)); } } ` Danke im Vorraus 😉

---

<div class="post-metadata">

### Author: ![ecomai](https://avatars.discourse-cdn.com/v4/letter/e/8e8cbc/32.png) [@ecomai](https://forum.shopware.com/u/ecomai)
#### Post date: [10. Januar 2013 um 15:51 UTC](https://forum.shopware.com/t/plugin-shopware-modules-order-sendmail-beforesend/10844/2 "2013-01-10T15:51:54Z")

</div>

An die Ordernumber solltes du so kommen: ` $sOrder = $args-\>getSubject(); $ordernumber = $sOrder-\>sOrderNumber; `
