How to send email to registered user (MVC) RRS feed

  • Question

  • My problem is this one, I have users that are registered in a basic MVC 5 application, when they register they provide email address and a username. In the application userA can see what userB created (ie a product or whatever), what I want to do is that for userA to "contact" userB by clicking on a button, however userA will not see the email address of userB, the application will send the mail on its behalf (sendgrid).

    My pain points are :

    1 - once userA click the button, a small issue is how open a new page where he can type its subject and message without loosing the username of userB

    2 - how can I retrieve the email address of userB ? I can't find a way to retrieve the email address of the user

    Thank you in advance !

    • Moved by Mike Danes Saturday, June 6, 2015 5:58 AM asp.net specific
    Friday, June 5, 2015 6:28 PM


All replies

  • That is where a token or key comes into action. Since you do not want user A to be able to see the email address of user B, you can use a token or User ID of the user B to get the email address. 

    (Off-topic, but still) In ASP.NET (perhaps you are using the ASP.NET Identity) you have the ability to get the details of a user based on his ID. You can use this ID to allow user A to contact user B while having his actual email address hidden in your database. Then, upon submit request, you should use that ID and get the email address of user B and send the email to him. 

    For more on ASP.NET, please use their forums. This is forum related to Visual C# only.

    The sh*t I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem

    Friday, June 5, 2015 6:58 PM
  • http://forums.asp.net/ MVC section is there.
    • Proposed as answer by Just Karl Wednesday, June 10, 2015 2:57 PM
    • Marked as answer by Just Karl Wednesday, July 8, 2015 8:02 PM
    Friday, June 5, 2015 7:45 PM