Last post Aug 16, 2010 12:20 PM by RichardY
Aug 16, 2010 04:45 AM|LauraHolmes|LINK
I'm wondering what is the best way to do something - I've to write data to database along with sending an email with these details.
In asp.net using C#, What is the best way to do this?
Would you suggest writing to the database first, then sending email or doing it all at the same time?!
I'm confused about this one..
Aug 16, 2010 06:09 AM|XIII|LINK
it looks to me that the information in the mail is dependent on the information in the database so I would say that you first write to your database and then send the email.
What if the email doesn't get through but the information's in the database. Is that scenario ok? Is there a fallback system needed? Is it transactional: meaning that if the mail doesn't get sent the information should not be in the database?
Aug 16, 2010 12:12 PM|LauraHolmes|LINK
Hi the application is transactional - in this case, how should it work?
Aug 16, 2010 12:20 PM|RichardY|LINK
Is it important to verify that the email was sent or that it was received?
If you only want to know that the email was sent successfully, then test for exceptions in your send mail method. If no errors then mark the email as sent.
If you want to verify that the email was received, then include a link in the email that the recipient must click to confirm receipt. This link would be to a URL you control and include enough detail in a query string that you can mark your database as