I am running a webapp on Apache Tomcat. I want my app to send out an email to the users, for certain actions. I have tried using Java Mail, but I am not happy with performance.
I would like to use an external service for the same. I came across MailChimp, but realized, it doesn't suit my requirements, as I want to send the mail IMMEDIATELY, rather than later, as a part of a campaign. I want something that will let me send a mail to an id, IMMEDIATELY.
Can anyone here, suggest any service, for this? Any reviews/past experiences? Will be very appreciated.
Cheers,
RD
Edit :
Thanks all for the suggestions. But I don't want to continue with my code for sending out emails. I have noticed issues with my email id getting blocked, infrequent delays of upto 3 hours before delivery of email etc. I want to use a webservice, which helps me send out mails. That is what, my question is.
Solution :
Thanks to all the help from the people here, mostly to JonLim, I zeroed in on PostageApp and PostmarkApp. However, finally settled on Postmark, because they seemed to have an easier Java client! I blogged a post on how I configured and integrated my webapp here.
You have plenty of email service providers at your disposal:
PostageApp (Ours!)
SendGrid
PostmarkApp
Amazon SES
Figure out which one suits your needs and take your pick!
(Full Disclosure: I am the Product Manager of PostageApp.)
The only issue with the java mail API is that it's not very developer-friendly. For that purpose there is commons-email. As for performance - its performance is fine - it just creates a raw SMTP request to the SMTP server. So the problem must be either in your code or in your SMTP server.
I think the first thing you should find out the source of the slowness (profiling your application). That will help determine how to improve it.
That being said, you should definitely take a look at your MTA configuration. I use postfix and it's fast, secure, and easy to configure and maintain.
Related
I know it is very basic question but I need a solid answer to clear my thoughts on it.
I am sending user credentials, key etc in header part in POST method,
Is it a good way? if not then why?
It's a bad way of doing things like these since if somebody could intercept your request - they would get your credentials easily. Better to avoid or at least encrypt this kind of requests.
One of the most popular solutions nowadays is to use OAuth 2.0 (or even better - OpenID Connect). They will bring some complexity to your system but the cool thing about it is that your application doesn't have to deal with passwords at all. Everything is delegated to Authority Server. And there are a lot of the authorization servers ready to use, for instance Keycloak (we have been using it and it and it was really good experience for us)
i would like to know how the update messages in this stack overflow site have been implemented.
To be more precise, for example while i am trying to reply for question and i am in the middle of typing my response, i will see a message on top of the page saying a new answer has been added. How is this feature has been implemented.
AFAIK, the possible way can be HTML5 websocket or serversocket technology.
is there any other way to achieve this kind of push notification system especially using java, spring and jquery environment?
Not sure how to tag this question. correct the tags if i am wrong.
SO uses reverse ajax/comet technology to show those messages. I remember reading some discussion on meta about this feature, couldn't exactly find out the link for it at this moment. Will update as soon as I find.
Based on programming language framework name may change (websockets (or) socket.io etc.,), but at the end they all are from comet framework.
Update:
Here is SO meta discussion on this topic.
I have used the Direct Web Remoting framework with success. (DWR).
There are several ways to achieve that:
Polling: using JQuery you issue a request regularly (every 5sec for examples) which retrieves the updates from the server.
Streaming: you issue a request, the server does not set a Content-Length to the response and "never" close the socket. This way you can send data from server to client whenever you want. But it means that for every client a connection is hold by your server.
Long polling: mix between the two previous ways. The connection is hold by the server but with a timeout. If no new data is available, the server closes the connection and the client reopen a new one after a moment.
Thoses are Push technologies: http://en.wikipedia.org/wiki/Push_technology
Of course there are over ways to achieve that.
I am doing an app which renders a web page in an upnp enabled television set. I have implemented the UPnP with Cling UPnP
Now I am not sure how to proceed further. How is the connection between the Television and the device attained? Is it a socket connection? has anybody got any samples or tutorials regarding this topic which help me to implement UPnP streaming.
I have searched on google but it mainly points to existing apps available in google play.
Thanks
Ok, so the service descriptor xml (SCPD) contains <actionList> of <action>s with their parameters, which can be in (to the TV) or out (will be in the TV's response to the action). You need to "call" the action, which means that Cling serializes it to SOAP RPC and sends it to the device as HTTP request. In the response, you will get the overall result of the call as with plain HTTP, 200 for OK, 500 for Bad Request, etc. Each code has a specific explanation in context of the particular action call. The response will also hold out parameters as specified in the SCPD.
But this all is not as much of your interest when using an abstraction library like Cling. It will do everything for you. Disclaimer: i am not familiar with Cling, just with enough other UPnP libs to know where to look for things.
As a TV set, the 3 services you mention will be undoubtely AVTransport,ConnectionManager and RenderingControl. So to present a simple example which will actually do something observable on the TV, let's call RenderingControl.SetVolume. The method you need is org.teleal.cling.support.renderingcontrol.callback.SetVolume. I can't help you to the level of knowing where to obtain the Service parameter, but you should be able to figure out.
I am not saying that you don't need to know how UPnP works under the hood. Grabbing the UPnP specs bundle and reading at least the DeviceArchitecture pdf is indispensable. And you will definitely need the specs to understand the more complicated services like AVTransport. Hint: don't care about InstanceID and ConnectionID. It's all 0 unless you connect to a very advanced renderer (which the TVs nowadays are not).
So what I need is basically to create a java program that runs from command line and will continue to run until I decide to stop it. The goal of this program is to read email from a particular email address and create JIRA tickets using the contents of the email.
IE: subject of email will be title. Body will be description. Etc...
I am getting confused with how to go about with the design of how to do this. I know I can use JavaMail to gain access to the emails right? Then I just have to parse the email. But other than that I am a little stuck on how I should be making the JIRA Ticket
Thanks!
Your problem is an ideal use case for esb like mule or spring-integration. Basically these eip frameworks provide all building blocks you just need to connect.
First you need to define mail inbound. This component will automatically connect to an mail inbox and fetch all new messages.
Then define a transformation from e-mail message to json object. Finally POST that object using HTTP outbound. You can create ticket in JIRA using /rest/api/2/issue API method.
whole workflow can be implemented almost without coding. Of course you can do everything manually (using javamail and httpclient), but then threading, error handling and retrying is up to you.
For the future - if you're confused what requests are sent and so on - use Google Chrome.
Press Ctrl+Shift+I->Network and make request. If you need to login before etc. it is the same.
For handling HTTP requests (POST, GET, etc.) I recommend to use HttpClient or if you need to use JavaScript HtmlUnit.
So answer is this:
- Track what requests are made when you do certain things via web browser
- implements the same in Java code using HttpClient or HtmlUnit
I'm working on a server written in Java, and a client (a desktop application written in .Net) that runs on Windows machines on the same network. I would like to have some basic authentication so that the server can determine the username of the user running the client, without needing the user to re-enter their Windows password in the client.
Is this possible, and what's the simplest way to accomplish it?
I had a look at some of the available APIs, it looks as though the org.ietf.jgss package in Java, and NegotiateStream class in .Net, should probably be able to talk to one another to achieve this - but I keep hitting frustrating error messages I don't understand. I thought I'd check if this is the right approach, if so I'll post a separate question with more detail about the errors in question :)
The approach is the right one. Notice a number of things, though:
this will have nothing to do with "Basic Authentication" (in http)
.NET will try to use the SPNEGO GSS mechanism. See the Sun documentation for proper support of this mechanism.
your service will need to incarnate a service principal. So you need to create an Active Directory account not only for the user, but also for the service, and you need to put the service's password into the Java keytab.
If you're using Active Directory, I think the Spring LDAP module can offer you a nice way to access credentials.
Not being familiar with the GSS mechanism. I would suggest a shared key mechanism used in passwordless ssh.
This open source library http://spnego.sourceforge.net has exactly what you are looking for. It implements an HTTP Servlet Filter on the server so that your web-app can call request.getRemoteUser() to find out the username.