sending and recieving mail in c#

I need help again :(

I'm trying to do send mail to a user, with a OK and Cancel button,

I can send mail but I couldn't add buttons.

The second and the more important problem is that: I want to take feedback from user. If user clicks Ok button then my code will add a record to my MS SQL SERVER database, if user clicks Cancel button then my code will delete a record from my SQL SERVER database.




Answer this question

sending and recieving mail in c#

  • Jeff Levinson

    In the IDE design mode, if you double click the button you will enter it's click event, put your code in there.

  • japt

    that's an interesting one. I'm not even sure you can. you can embed HTML elements in the body I believe as long as you have the mailMessage in HTML format but when you want to actually go ahead and delete that record, you cant do it from HTML. You need pretty much .NET to do this (or some other way)

  • Joannes Vermorel - MSP

    to send mail:

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=760457&SiteID=1

     

    To add a record into SQL Server, recommended approach would be to use a Stored Procedure. It's faster, and securer. However hopefully this will guide you in terms of adding a record

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=704513&SiteID=1

    you would of course need to import the System.Data.SqlClient to access the Sql classes. To delete a record would be the same way execpt the command would be:

    DELETE FROM tableName WHERE [FieldName] = Value

    However if the user hasnt pressed OK then there is nothing to delete from the database, since according to your statement you only want to insert a record when the user presses OK

    does this help



  • r0d

    Hi;
    What you would have to do it make your mail body in html format and the buttons you add are actually links to pages on your form. When the user clicks on OK the link will be http://your-application.com/gotemail.aspx status=OK or http://your-application.com/gotemail.aspx status=CANCEL .
    Hope that helped
    Regards
    Shivam

  • MNDANG

    I think I couldn't ask my question correctly. I can send mail or add/remove records. My problem is that:

    I want to send buttons in the mail. The mail recipient will click OK/Cancel button in the mail and then my code will execute (write or delete record).



  • sending and recieving mail in c#