Postfix mail server and thousands of users? - jakarta-mail

greetings all
I have a postfix mail server that contains many domains
and each domain contains many users (each user has a mailBox)
and I want to handle that when an email comes to any mailBox of any user in all domains do some java code.
any ideas how this could be done ?

If the users have a 'real' system account, you can put a .forward into their home directory that looks like
"|/path/to/your/mail/handling/program"
which would automatically pipe the email to your program when it's received. Otherwise you could tweak the local delivery agent to do it for you.

I got to a solution to forward all the incoming emails to one single mailbox, using postfix with mysql db, and added a thread that runs every 5 seconds to check for new unread emails to that single one mailbox using javamail

Related

Placing SQL Server generated emails in Outlook Outbox

We send monthly emails generated in SQL Server(2017) using sp_send_dbmail to clients containing sensitive data. Recently, there's been a breach where a client received something they shouldn't have received. The cause of this is honestly just bad code, but going forward we want to be able to screen emails more effectively. We are now avoiding the sensitive data issue by asking clients to log in to our system to look at this data instead. Whilst this would be perfectly normal procedure, certain people demand everything in an email. It's a security problem, but the client wants what they want, and the head honcho wants to give the client what they want.
We use Outlook, which has an outbox that nobody really uses anymore as far as I know. Is there a way to get SQL Server to place emails into a shared outbox account so that we can screen emails that contain sensitive data before we send them out?
For initial QA, data for emails containing alerts are generated via stored procedures and sent to QA analysts to check over. This is done by manually setting the recipients to the QA analysts for emails to all clients.
We don't expect them to cover every email as that would be insane, so we ask that they check a random selection to be confident enough that the data is accurate.
Once they are happy, we run the stored procedures again but we pass a parameter so that it cursors through a table that contains every email alert for each client and generates the tailored email for each client and is sent using sp_send_dbmail.
In other words, the email being screened by the QA analysts might not be the same as the email send to clients. This is how the breach occurred.
If we had a way to get these emails into a shared outbox, the QA work can be done on that shared outbox and then we can send the emails. Asking someone to hit send for a big bunch of emails would still be a pain, but perhaps a little less so than having another breach.
AFAIK sp_send_dbmail uses SMTP to send messages. If you want to place messages in the Drafts (or any other) folder of a particular mailbox, you will need to create messages (without sending) using Graph or EWS.

java googlemail blocks multiple access

I need to allow a user of my App to email themselves when an even occurs. I am not sure how to do this.
My first idea is to create a dummy gmail account, and have my App sign-in and send from there via java code. This means hardcoding the password BUT as account not used for anything other than one way emailing - it does not seem to be a problem.
However, I understand that google is pretty proactive about security and if my App (which is global) tries to log into same account in several different countries during a 24 hour period - it will block the email.
I have seen the "delegate" functionality, but that would mean that each user needs their own gmail account which is not practical.
Is there a way to force gmail to allow the sign-ins to happen from wherever?
Or is there a better approach to this problem?
probably not a good idea to have your app to mail from a private account, if I understand you correctly. Best to use email service like http://expresspigeon.com or http://sendgrid.com and simply send a transactional email from your app account. In other words, use an ESP.
The safest would be to ask the user for all the configuration information necessary to access their email server as themself, then send the email as themself to themself. You can use JavaMail to send the message, but you'll need to ask for all the configuration information that any other email application would ask for in order to configure access to their mail server.
There may also be Android-specific ways to do this using the default email application.

Google-app script: Send mail from secondary mailadress

I have the following situation:
xxx#gmail.com (gmail login)
xxx#company.be (mails are standard send from this mailadress)
So far so good.
I use a script in google apps to send a newsletter to all my contacts.
The script always uses the xxx#gmail.com adress instead of xxx#company.be
This is the specific part of the script:
var emailYourAddr = Session.getUser().getEmail();
Does anybody know how to change the script so the mails will be sent from the standard mailadress?
Thank you very much in advance!
You will have to first configure the company mail with gmail and then Use the company email as alias to send to send mail where the from field will show company email.
Below two links might be helpful to you.
http://support.google.com/mail/bin/answer.py?hl=en&answer=22370
https://developers.google.com/apps-script/class_gmailapp#getAliases

Do the same GAE channel tokens work between tabs?

Going by the GAE docs for the Channel API,
Only one client at a time can connect to a channel using a given
Client ID, so an application cannot use a Client ID for fan-out. In
other words, it's not possible to create a central Client ID for
connections to multiple clients.
seems contradictory to
Treat the token returned by create_channel() as a secret. If a
malicious application gains access to the token, it could listen to
messages sent along the channel you are using.
How can they both be true? But more importantly, I'm planning to create one channel for each logged in user in my app. Now if the user opens up a new tab with the app, can I use the same token again? The alternative of creating one channel per tab the user has open sounds quite odd, not to mention expensive.
If you open more than one socket on a channel with the same token, results are undefined. Both sockets may receive messages, or neither, or just one. (actually we technically support two connections reliably, for cases where the user refreshes a page)
If you want to support multiple connections by the same user (in different tabs or different computers or whatever), you'll need to create a clientids per tab/browser instance/computer etc.

Sending Programmatic Email Messages

I'm looking to send email messages programmatically from my websites. For example, if people register their email address, I would like to email them to confirm their email address. To do this I will need to use an email sending tool and plug into an smtp service. In the past (7 or so years ago) I used Jmail, however, I am not sure what are the best services to use today and how spam filters have envolved!
I have three specific questions:
Does it matter which service I use to send emails programmatically (e.g., PhpMail, Jmail, etc.)? If so, which tools would you recommend?
How should I host this tool? I plan on sending a large volume of emails (thousands to hundreds of thousands). Would it make sense to use google-app-engine mail service to do this, or should I just host it on my own server (e.g., have my own SMTP server)?
I don't want my emails to be sent to spam folders, how can I ensure that the emails are received by the users?
Thanks!
No, you don't need your own. Based on the tags of your message, I'm going to assume you are using java and deploying your app on Google App Engine?
http://code.google.com/appengine/docs/java/mail/

Resources