I am trying to come up with a way to email a dev team when an exception occurs on a web page that I am developing. I heard of ELMAH, but I was hoping to use an internal Microsoft library to try and do that. I thought I saw an article online with a library, but I can't seem to find it (saw it last Friday and I can't seem to find it). If you could even point me to a tutorial of some kind, then I would appreciate it.
many logging frameworks are capable of sending an email on a logged exception.
MS wrote the Enterprise Library: use the email trace listener
Enterprise Library: Logging Block and Email
or you can use a 3rd party such as log4net : smtp appender
http://logging.apache.org/log4net/release/config-examples.html
Elmah is not MS but here is a tutorial for that
http://www.storm-consultancy.com/blog/development/tools-plugins/setup-email-alerts-from-elmah-when-exceptions-are-raised/
enjoy
I don't see any problem using ELMAH, it is very stable.
Here is a good post to handle the error and send email:
http://www.codecapers.com/post/Error-Handling-in-MVC-with-ELMAH.aspx
Related
I can send mail using SmtpClient class, but are there any classes that allow reading mails? I tried to find something out, but it wasn't sucsessfull.
Maybe others can correct me but SmtpClient class is C# and not C++ right?
I don't know how up-to-date it is but here is EmailArchitect's tutorial for "Retrieve Email and Parse Email in C++/CLI/CLR. It looks like it uses EmailArchitect's binary so it's unfortunate but it could be a paid route.
Another way could be researching the libcurl/curl/cURL route which supports multiple protocols and have many examples online (though I haven't checked them out myself).
I am automating an application using selenium webdriver which sends the email alerts on clicking on a particular button. So I need a dedicated email system which will receive the emails and we can use its APis or some other feature which can be used to verify whether the mail was actually sent and we can also verify the mail content.
You can use Mailinator service, it is free if you just want to navigate the emails. However it also provides the API for dev purposes but its paid.
I'd recommend GreenMail:
GreenMail is an open source, intuitive and easy-to-use test suite of
email servers for testing purposes.
Typical use cases include mail integration testing or a lightweight
sand boxed mail server for development.
Supports SMTP, POP3 and IMAP including SSL
Prevents accidental email leaking to real mail servers
Provides different deployment models,
such as WAR module or JBoss GreenMail Service
Easily embeddable in JUnit tests for integration testing
Lightweight with few dependencies
GreenMail is the first and only library that offers a test framework
for both receiving and retrieving emails from Java.
I did a bit R&D and found a solution. The solution is using the Gmail API.
Below is a link for more description and clarification-
EMAIL VERIFICATION FROM GMAIL ACCOUNT IN SELENIUM WEBDRIVER (JAVA)
This looks like a good solution, But I am still looking for the best approach.
Kindly let me know if a dedication email platform really exist for testing purpose.
I am in the process of scoping the development of an iPhone app for a client. Among other things, the app will allow users to browse through and place orders on specific (tangible) products.
The client has a website that currently does a similar thing and due to their limited budget and the fact that the website runs on a third-party proprietary platform which they have no control over, we are investigating possible alternatives to building a web service.
On the website, user registration and authentication, as well as order placing is done through POST requests via secure HTTP. The response is always a formatted HTML page which will contain strings indicating whether the request was successful or not, and if there was an error, what the error is etc.
So provided I can replicate the POST requests on the phone, and parse the HTML responses to read the results of each request, do you think this is an acceptable alternative to building a web service to handle this?
Apart from the possibility of pages changing (which we can manage) and the fact that I will probably have to download and parse a relatively large HTML response, are there any other drawbacks to this solution and is there anything else that I might be missing?
Many thanks in advance for your thoughts.
Cheers,
Rog
You could create an intermediary server that will communicate with the client server, and on it expose some REST web services with json (small overhead and easy to handle) responses that will be consumed by the iPhone app.
So, you're going to parse HTML and formulate POSTs off a third-party server, and pray that they don't even so much as rename a form field.
Your question is in two parts:
Do I think that a miracle is an acceptable solution? I don't.
Do I think that aside from the fact a miracle is required, are there any other drawbacks? None that I can think of.
You didn't ask, but this is a terrible course of action. Two suggestions.
I spy an assumption that the providers of the third-party platform aren't interested in enabling third-party applications by providing an API. They have a very good business reason for this, which is that it promotes platform lock-in. Reach out to their support department and have a talk with them.
You have to sell the client on building an intermediary web service. To at least try to mitigate the damage that changes on this third-party platform can do to your app, I recommend that you build and operate a proxy that receives requests from your applications, and proxies them over to the third-party platform. You should build into this client-server protocol a means for returning "we are in maintenance mode, go away" messages to apps, for that inevitable day when the third-party server changes something that breaks your app (they swapped the billing and shipping address pages, for instance) and you have to rush through an update through Apple to deal with it.
The proxy could be written in something more flexible and easy to bash stuff out in, such as PHP, Python, Perl, or Ruby. It could be hosted at Amazon in a micro instance.
p.s. This question is inappropriately tagged objective C.
HTML is the worst because of parsing (1-2secs per page), memory, and changes, but you already know that. Check in advance that ALL the data you need is exposed on the HTML.
If you use an intermediary server you are moving work elsewhere and you have another server to maintain. I would only do that if memory is an issue. Check How To Choose The Best XML Parser for Your iPhone Project for memory/performance/xpath support. libxml2 is a good option, but it depends on your needs. And maybe you'll want to check ASIHTTPRequest features before using the SDK.
I think utilising the web language of JSON would contribute to the diminishing of the parsing time. By building a REST service that, when sent a GET request, returns the correct information for easy sorting, you could then display the output a lot faster than that of parsing straight HTML.
I prefer JSON over XML, but everyone has their personal preference. You should look at a few very good libraries that are built specifically for parsing purposes of both XML and JSON.
For XML I recommend using the inbuilt libxml parser. Albeit, this can sometimes deem very difficult to use. A simple Google search will bring up a heap of results that relate specifically to what parser should be used depending on what task is to be completed.
As for a JSON parser, I recommend SBJSON. I am currently using it one of the biggest projects I have undertaken and it is definitely working perfectly for my use.
If you need a good way to connect to a RESTful web service, you should try LRResty.
Don't go for a parsing solution on the iPhone for 4 reasons:
Server can change their design and break your application (AppStore submition is long) + They can also detect that the request are sent from an application based on user agent which you have to update the application to change it.
Some of the requests might be made thru Javascript so you not only have to parse (X)HTML but also Javascript request (which can be in the form of XMLHttpRequest, but don't have to)
Long term evolution of the mobile market : maybe your client want (or will want) an application for android, Blackberry, Bada OS (Samsung), Symbian (Nokia/ OVIStore), Java Mobile or Windows Phone 7?
Of course network traffic, Memory and CPU needed to parse HTML (look the time it takes to the browser to do it?)
Regarding the traffic, if the application will not have a huge traffic you can home-host your proxy. Or you can find some provider to host it for you. I guess you won't need more than a couple of Megabytes of storage but maybe traffic. For less than 100€/year you can find some with unlimited traffic (like OVH Pro plan or Infomaniak). But if you want to go Java have a look at Google App Engine : you pay only if your traffic is important and if your application generate many CPU Cycles. If not : you don't have to pay. And it's hosted on Google server : reliable.
If the client is open, you could consider the paypal API.
I need to write an application that can read email and attachments from a mailbox in Exchange 2007. What is the best way to do this? Outlook Redemption works, but is there a better way?
You could simply us POP3 or IMAP to access the mails on the Exchange server.
Depending on your environment you would probably find libraries that provide POP3 or IMAP implementation.
There are several ways to do this. Starting from POP3 or IMAP (as indicated by Dominik) to more powerful options such as the ones listed at Exchange Development Technologies.
I would avoid starting new developments with APIs that are being phased out by Microsoft, so you may want to take a look at the Exchange Server 2010's version of the article above.
A safe bet would be to use Exchange Web Services (a.k.a EWS). You should be able to program against it using any language capable of doing SOAP Web Services.
If you are programming against .Net Framework 3.5 or above and Exchange Server 2007 SP1 or above, you can use EWS Managed API which is the client-side API for EWS and offers a much cleaner experience than the one provided by auto-generated web service proxies (via Add Web Reference menu item).
Use Microsoft Exchange Server MAPI Editor (MFCMAPI) which is a great tool to retrieve MSG (or EML) files.
I personally use the cfexchangeConnection in coldfusion to reach out to mailboxes (as well as all other items in exchange)
My professor in the uni has asked me to design a simple website with a basic feedback form.
the form should NOT use 'mailto' for sending the feedback form e-mail
the form should NOT use server-side scripting (PHP, etc) for sending the feedback form e-mail.
Is is possible at all to send an e-mail from a website form without using any of these 2 options? Is there yet another option for sending an e-mail in this situation?
You could embed a Java applet or ActiveX control which does it for you.
No. The client-server model used by HTTP has the client and the server, both of which the professor has disallowed you to use. (Email does not use HTTP, but it's apparent in your question that you need to send mail from an HTTP context, and you need a computer on which to do that.)
I am not aware of a solution without using any of these 2 options.
Mybe your professor only doesn't whant that you scipt a solution. I guess there are plenty of feedback solutions as services on the web. Most web hoster also have a mail cgi script or something like this installed...
The professor agreed, that any of the following 4 technologies can be used for this project:
Java applet
ActiveX component
Javascript
Flash (Actionscript).
Many thanks for the help.
(How exactly sending an e-mail is going to be achieved with these technologies without referencing i.e. 'mailto' in Javascript or in the flash application or without referencing the server is going to be the strange part of this coding though).