Asp Net Send Email On Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you
Namespace For Sending Mail In Asp Net
might have Meta Discuss the workings and policies of this site asp net sendmail About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or asp net smtpclient posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of
Asp Net Mailmessage
4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How to send error info mail, if any error occurred in web application up vote 1 down vote favorite Here the scenario is I have many .aspx pages if any page gives error, it will redirect
Smtp Exception Failure Sending Mail
to an error page Web.config:
Latest Articles Latest Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog smtpfailedrecipientexception quick answersQ&A Ask a Question View Unanswered Questions View All Questions... C# questions
Smtpstatuscode
Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales smtpexception / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift http://stackoverflow.com/questions/11807891/how-to-send-error-info-mail-if-any-error-occurred-in-web-application Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider http://www.codeproject.com/Tips/259139/Send-ASP-NET-formatted-errors-details-via-Email News The Weird & The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Articles » Web Development » ASP.NET » General Tip/TrickBrowse CodeStatsRevisions (8)Alternatives (1) Comments (17) Add your ownalternative version Tagged as ASP.NET Stats 46.6K views21 bookmarked Posted 23 Sep 2011 Send ASP.NET formatted exception details via email Mohammad A Rahman, 9 Oct 2011 CPOL 4.95 (13 votes) 1 2 3 4 5 4.95/5 - 13 votesμ 4.95, σa 1.05 [?] Rate this: Please Sign up or sign in to vote. How to send ASP.NET formatted exception details via email Managing Exception/Error is a common task in any application. In ASP.NET, there are many ways to handle those errors or exceptions, for example, when an error or exception occurrs in an ASP.NET application, the system is going to send a formatted error message to specified developers or teams mentioned in the email list. The difference will b
» 3.0 Advanced Samples » 4.0 Fixing System.Web.Mail » 5.0 More Resources » 6.0 RFCs » 7.0 Third Party Products » Complete FAQ » Submit Comments » About Me » About My Products » Site Index Sponsored by www.aspnetemail.com System.Web.Mail FAQ Complete FAQ Listing 3 Advanced Programming Samples 3.1 How do I send non US-ASCII emails? 3.2 How do I send a web page? 3.3 How do I embed images in an email? 3.4 How do I email a website exception * You Are Here * [Scroll To Answer] [ Discuss ] 3.5 How do I encrypt messages using s/mime or pgp? 3.6 How do I send multipart/related emails? 3.7 How do I send multipart/alternative emails? 3.8 How do I authenticate to send an email? 3.4 How do I email a website exception Printer Friendly Email This FAQ Discuss The global.asax class uses the Application_Error method to capture errors. Using System.Web.Mail, a webmaster can email themselves every time an error occurs. The following code snippets demonstrates this technique. [ C# ] protected void Application_Error(Object sender, EventArgs e) { Exception ex = Server.GetLastError(); EmailException( ex ); } private void EmailException( Exception ex ) { MailMessage mail = new MailMessage(); mail.To = "me@mycompany.com"; mail.From = "you@yourcompany.com"; mail.Subject = "An exception occurred."; mail.Body = ex.ToString(); SmtpMail.SmtpServer = "localhost"; //your real server goes here SmtpMail.Send( mail ); } [ VB.NET ] Protected Sub Application_Error(sender As [Object], e As EventArgs) Dim ex As Exception = Server.GetLastError() EmailException(ex) End Sub 'Application_Error Private Sub EmailException(ex As Exception) Dim mail As New MailMessage() mail.To = "me@mycompany.com" mail.From = "you@yourcompany.com" mail.Subject = "An exception occurred." mail.Body = ex.ToString() SmtpMail.SmtpServer = "localhost" 'your real server goes here SmtpMail.Send(mail) End Sub 'EmailException Discuss This FAQ Item Got a question? Another Suggestion? Want to post your solution? Discuss it below. New Post Handling email address error [ Reply ] I am an asp.ne