0

I need to send an email after a customer try to save a new address in his address book

3
  • are you talking about frontend? Commented Nov 3, 2021 at 10:08
  • Yes, in customer dashboard
    – sara ben
    Commented Nov 3, 2021 at 10:26
  • Kindly check the answer I posted. Commented Nov 3, 2021 at 10:52

2 Answers 2

0

You can use below events for customer address.

<event name="customer_address_save_after">
    <observer name="customer_addres_after_save_event_observer" instance="Vendor\Extension\Observer\AfterAddressSaveObserver" />
</event>

OR

<event name="customer_address_save_before">
    <observer name="customer_address_before_save_event_observer" instance="Vendor\Extension\Observer\BeforeAddressSaveObserver" />
</event>
2
  • Could you please explain where to put this code, Thank you for your answer
    – sara ben
    Commented Nov 3, 2021 at 11:09
  • You need to create events.xml into extension and put the code there. Commented Nov 6, 2021 at 17:37
0

You should create etc/frontend/events.xml file in your module and post there event from Dhiren Vasoya comment. Then create the class Vendor\Extension\Observer\BeforeAddressSaveObserver OR Vendor\Extension\Observer\BeforeAddressSaveObserver depending on your event name and send email inside the class. You can google a little and find the way how to send email with custom template and parameters.

Your Answer

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

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