Search code examples
.netmodel-view-controllerumbraco

How to create a post-method in an UmbracoApiController to send an Email using SMTP


I'm trying to create a post method in UmbracoApiController but can't figure it out. However, I did create one using SurfaceController. Any help would be much appreciated.


Solution

  • If you have created it by SurfaceController, you should be able to create it by UmbracoApi almost the same way. I guess you might use a wrong URL. For Surface controller you usually use this routing:

    /umbraco/surface/{controllername}/{action}/{id}
    

    When for API you should use something like this url:

    /Umbraco/Api/Products/GetAllProducts
    

    it means you should replace surface with api. If it is not the case, can you please share your code. It can be really helpful.