Sending email SMTP[Answered]
I am trying to send an email using SMTP. The backend works, and i can send emails via Swagger. But i just cannot make it work from the Blazor FrontEnd
I get the MimeKit No address found exception as seen in the snippet.
I have a service on the client that refers to the controller and service on server side.
Gonna attach snippets of relevant classes
Thanks for the help in advance! 🙂
12 Replies
Set a breakpoint and see what the value of
request.To
isUnknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yes, it just seems that the ''To'' email is not recognized by MimeKit, and im not sure why
That specific error shows up when the startIndex and endIndex is equal in the parser so my guess is your To is an empty string or something if I read the parser correctly
Yes, the issue is definitely, that the frontend input is not processed to the backend. I've been trying a few things to fix it, but i just cant figure it out. Maybe i'll look into SendGrid
Try use [FromBody] instead of [FromForm] because I see you are posting using json and I think the attributes handle the information differently?
But as you can see, it does take the input
I'm not an asp.net user so I'm kind of stabbing in the dark
Oh true, [FromForm] was used for swagger testing, lets try that
I was reading this stack overflow post that stated
https://stackoverflow.com/questions/50453578/asp-net-core-fromform-and-frombody-same-action
Thanks, that was literally the problem
nice