How to receive emails of the same inbox from multiple server instances - email

I have an application running on WebLogic Server with 6 instances. Many requests for the application come from Email. We already set up an email account that will be used by all clients to send email to. But the problem is that the email account inbox can only be opened for reading by a single connection, unlike a typical database.
Currently I can only deploy the email reading service on a single server instance, this will effectively create a single point of failure and unbalanced load. What's the best way to read from the same inbox from multiple servers? I am thinking developing something using a database table, sort of leasing, whoever locked the table own the lease and can connect to the email server, but this is pretty hard to implement correctly in all circumstances.

I am not sure why you say that only one client can access the inbox as POP certainly can handle multiple connections to the same inbox and this can be configured in the mail server. You might need to talk to your mail server admin.
I haven't worked with Weblogic to give you a specific answer, but you should also be able to have a service written that checks the incoming mail and process incoming mails into a database as you wanted. Once the information is in a database, you can use it via multiple hosts. This is a better approach as this can be setup to prevent multiple clients responding to the same email.

Related

Send emails from flutter application without expenses or smtp server and without opening the gmail app

As the title says, I would like to know if there is any way to send emails without having to use an external service, that charges me for sending the messages, or having to use an SMTP server in which each user has to be registered.
I have also seen pages like email.js but I don't want to have to pay for that if there is a possibility to do it on my own. It is also not useful for me to open the Gmail or messaging application of the device itself since I already know how to do that and it is not what I want.
For better understanding, I will give an example of what I want to do.
What I want is that from my application the user writes a message and from there that email message is sent to several different users from a list, without having to log in or anything, since the emails will be sent from my own email account. gmail that I have specifically created for the application.
I have seen the smtp server but from the information that I have seen that server implies that I have to log in to be able to have the token and that is not what I want because I want that once I configure everything there is no need to do anything else that people receive your messages and that's it.
I don't know if this is possible but I hope someone can help me.
Sending emails without your user logging in would require you to have either the credentials stored in the app (which is unsafe) or use a custom backend server that will host all the credentials that cannot be extracted. I would advise going with the backend route because it is easier to setup and your application will simply perform a HTTP request to get it done.
From the documentation of the mailer package, you can implement the server method pretty easily and get it moving. You will have to find a free web hosting service to deploy to.
There would really be otherwise no other way to get what you desire for virtually free.

What email server or online email service allows for creating unlimited email alias for an inbox (via API)

Here is the reason for my peculiar question:
I am working on a mortgage application for a mortgage broker where each mortgage application is a record. Now this broker will take each of the applications he has received and enter this application (in an up line lender's system) and during the life of this mortgage application, he receives notification emails about updates from the up line lender.
It is required that in this application, all emails pertaining to a particular mortgage application are visible under that record.
My plan is to have all emails collect in a single inbox, and give that inbox an alias corresponding to the record id of the mortgage record. The alias remains active as long as the mortgage application is active and the broker cares for receiving these updates. Once the mortgage application record is dead, that alias is removed.
When displaying the particular mortgage record, I can query the mail server for the emails where the to address is the alias of that particular record.
My key requirements are:
The email server or email service should allow for about 400-500 aliases at a time.
Should have an API interface for creating and deleting an alias.
As far as the creating/deleting API is concerned, Google Apps (https://developers.google.com/admin-sdk/directory/v1/guides/manage-user-aliases) really fits the requirement, but has a 30 alias limit.
Does Microsoft Outlook online mail support this kind of API and ability to create mailbox alias?
If we went in the direction of having a Microsoft Exchange Server 2010/2013, would it allow programmatic access to create aliases? What would be the license cost?
Thanks in advance for looking this up.
With update from #mti2935, I am considering a catch-all solution rather then deal with creating aliases.
So, now I think all I need is to be able to process the emails. What's the best means of processing emails (in my case, I will simply have to look at the "to" field and put the emails in different buckets).
I have found a third party service that can help me parse emails. Definitely going to try that out and provide an update here.
Service: https://postmarkapp.com/inbound
Referenced by a post on: How to setup a mail server?
One option to consider is to setup a mail server using qmail, configured as a catch-all for your domain, such that all mail to *#yourdomain.tld forwards to a script which parses each incoming message, scrapes the to, from, subject, etc. logs the messages in your database, etc. It's easier than it sounds to setup. See How to setup a mail server?. This can be done fairly inexpensively on a Rackspace or AWS cloud server.

Can an IMAP client automatically filter messages that an IMAP server receives?

Let's suppose I have created an IMAP client and I want to create a filter that, say, deletes messages that have certain characteristics.
I can make this a startup task that happens whenever the client is opened, but the problen is that a user might view the inbox in a different client and the filter won't get rid of the unwanted messages before the inbox is viewed.
Is there some way to tell the server to call my service every time it receives a message so the unwanted messages can go away once the server receives them instead of once a client is opened? Is this even possible with IMAP? If not, is there a different well supported e-mail technology that allows this sort of interaction?
You can do server-side email filtering with the Sieve Email Filtering Language and the ManageSieve Protocol. There is good support in open-source software. However, I am only aware of a few major email providers, that support it. If it is supported, it is usually accessible on the IMAP host and with the IMAP account credentials, i.e. you can test it by connecting to TCP port 2000 and 4190.
See the following three links for more information:
http://en.wikipedia.org/wiki/Sieve_%28mail_filtering_language%29
https://www.rfc-editor.org/rfc/rfc5228 (Sieve: An Email Filtering Language)
https://www.rfc-editor.org/rfc/rfc5804 (ManageSieve Protocol)
Sieve also supports a few notifications types. If the filtering language is not powerful enough to for your purposes, you can send notifications for all incoming emails, wake up the IMAP client, and let the client to the filtering.

Coldfusion : Listening to the Email messages

I am trying to have a kind of observer pattern in ColdFusion
We want to listen to the incoming Email messages and act on them. Scenario is something like this :
Application sends email to the helpdesk system
Helpdesk system automatically generates a ticket and responds with an email to the email address of the application
The application's email is configured in the Lotus notes
Now the application should listen to this incoming email message, decode that and update the coressponding ticketid
I see there is a possibility with Event Gateways, but I am unable to realize the whole picture.
Thoughts or suggestions?
One way is to setup an email server with IMAP support, and use some sort of polling (every minute, good enough?) in CF using <cfimap> to get the emails.
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS371453EC-36D5-44ce-BF1E-750E3016BBD6.html
We have a system like this.
We have a postfix server configured to handle mail for a domain. A small script (Perl) on the postfix server places each email on an ActiveMQ queue.
We have a cluster of CF boxes with the ActiveMQ event gateway listener that takes the messages off the queue and processes them using Java Mail.
The delay between postfix receiving the email and a CF server processing it is generally under 1s.
We needed to do it this way for a number of reasons, processing delay being one of them, dealing with a large cluster of CF which made the POP/IMAP solution complicated, and CF's mail handling not being quite what we wanted were others.
It works great.
I've created similar applications in the past using cfpop to interogate a mailbox on a scheduled basis.
It was pretty easy to write, but usually gets thrown for a loop when "users" start being "helpful" with the email content.
The other thing is that this isn't instantaneous, but is the process really time critical to the second?

Accepting emails from domain with wildcard subdomain

I'm setting up an app to preform mailhooks. You create an account, assign a callback url, and a pattern to match. Then you get a subdomain that you can send email to. Something like accountname.mail.appdomain.com.
This is how it might work.
Pattern: ^(?P\w+)-reply$
Account: accountname
Callback: http://www.someotherapp.com/reply/create/
If someone sends an email to 12345-reply#accountname.mail.appdomain.com I need to be able to collect that email in I guess a catch all mailbox. Then have a background job that fetches mail and routes them based on the TO address and custom domain.
The problem I am running into is how to get the email server to accept these incoming emails. Right now I have a MX record set up that points from *.mail.appdomain.com to mx1.emailsrvr.com and mx2. When I "dig" I get the correct routing however I don't think the email server is set up to accept the incoming mail.
If this is not possible another option I have been playing with is creating a python smtp server using the built-in smtp lib. All this server would do is accept incoming requests to port 25 and place the mail in a queue. I have that working fine I'm just worried that not using a real smtp server might create problems.
BTW: The main server will be running on slicehost, if that matters.
ALSO: This server is not going to be sending email from these custom domain, if that matters.
What you need is a dynamic configuration of your mail server, right? Then this depends on your mail server capabilities.
If you use Postfix then you could add virtual domain setup being configured in MySQL tables. Or other databases. From within your application you then only need to add/remove rows in these tables to accept only the valid domains.
Same goes for Exim which is even more extensible.