Email Search Using database in postfix, dovcot and imap - email

I have installed rainloop for my office website, though it is very user friendly and i'm using a email server for my domain emails.
I am using Postfix and dovecot in email server. IMAP and SMTP for incoming and outgoing respectively.
Less than 1 000 emails in account is very easy to search, but when it comes to more than 100 000 emails, the search in email subject or from or to is very very slow, and it is taking more than 5 minutes to get the result.
I want to make the email search is fast when it comes to large mailbox case. I'm thinking to make a database based search at least for my email id.
Can anybody help me to get the hooks for email delete, read and unread options in dovecot or postfix? Though I could not able to get any exact clue to retrieve the above.

Related

Send mail with sendmail to gmail

I have a server on OVH and I'm trying to send some mail to my Gmail address using sendmail.
I installed sendmail with apt-get on debian, and echo "Subject: test" | /usr/sbin/sendmail -v mymail#gmail.com works. However Gmail puts the mail in the spam folder and says the mail is not authenticated.
I have no knowledge of how email works and from what I've seen I could use SPF or DKIM to provide authentication, but it seems it requires admin access to ovh DNS servers.
What would be the easiest way, using only admin access to the server that sends mails, to make sure emails sent from it are not marked as spam ?
Thanks
There are no easy way. That's the simple answer.
Google Mail is fighting spam every second, every day, all year. To get mail delivered directly to the inbox requires time and patience and there are no shortcuts. If there where, spammers would have it way to easy!
You are very correct that Google's SMTP servers will ask you to beef up your SMTP mail headers to include better authentication and security. There's no way around it if you want to be on good terms with Google's SMTP servers.
Here is a list of things to consider
SPF (Must have, also to defend spam sent in your name)
DKIM (Must have, this is somewhat a step up from SPF)
ESMTP (Google likes it when you talk to them encrypted)
Bulk headers (Use them if it's bulk, no reason to lie!)
Unsubscribe headers (Use them if you are sending out maillist content)
SMTP relay's with nice Senderscores (Easy access to the inbox, but cost)
SMTP relay's with good reputation (Easy access to the inbox, but cost)
Feedback loop headers/setup (If you send large amount of mails)
Only use "warmed up" SMTP relay servers (Mostly used by bulk senders)
Reverse DNS to match HELO/HELO (Mismatch can make problems)
Static IP (It's a given)
As you can see it's no simple task to "just" send an email to Google and expect it to be passed along to the users Inbox without getting targeted as spam.
Most of the options above requires extensive server knowlagde or that your hosting provider supports it. You need to have access to change your own DNS records but also the SMTP server that you send your mail from needs to be setup with the things in advance.
Now to the:
"How to send emails to Google Mail that always land in the inbox for dummies"
Well you basically buy your way into the inbox. Use SMTP services like Mailchimp, Amazon AWS-SMS (Simple Mail Service) many if not all of these services have already setup DKIM, SPF and are on good terms with Google. They do however have many rules and what and what not to do so if you don't follow the rules they will close your account right away.

DirectAdmin Blocks after 100 non-existing emails

I have installed phplist on the server for E-mail marketing but when it has send 100 E-mails to non-existing adresses DirectAdmin blocks the email account.
When this happends I must change the password but I have a list of 30.000 E-mails which needs to bounce first so I know which E-mails to delete from the database.
Is there a way to avoid the blocking and keep on sending E-mails to non-existing adresses?
I think you have setup mail limit on your server and due to that you are facing this issues, Please check following direct-admin help docs and try to update your mail limit.
https://help.directadmin.com/item.php?id=81

Custom mailing list system

On our website we use a MySQL table which contains all users. Some of the users should be able to send mails to all users. Unfortunately I haven't got the right idea how to implement such a system.
My current design:
A privileged user writes a mail to users#website.com using his personal mail software.
A server is waiting for incoming mails.
As soon as it receives a mail, it matches the 'From' field with the database.
If the user is not found or hasn't got the special flag, discard the mail.
Forward the mail to all users (mail addresses are saved in the database)
Send the sender a confirmation mail.
How can I implement such a system? I'm not required to stick to a certain programming language even though C++, PHP or Node.JS would be preferred.
As a jumping off point, look into IMAP/SMTP. You can, with any language, log into an email inbox, get emails, read them, etc etc etc. Set up your mailbox with an account users#website.com that receives legitimate emails. Then set up a cron job that checks the inbox every 5 minutes or so. If no emails are found, then you are done. If there is an email there, process it, run your checks against your DB, and then send it using SMTP, and then send the confirmation to the user.
If handling IMAP is too hard, you may just want to make a form on your website that privileged users can use which sends the emails to the users.

Create a lot of 200 different Email Accounts in a short span of time?

I am trying to send bulk email from a few accounts email accounts, and for some reason, I think the emails get blocked and they do not reach the recipient. I think it is because of spam / filtering rules. Is it possible for me to create say 100 different email accounts in a very short amount of time and send 1 email from each of the accounts ?
Is there any service/ idea / script to create a lot of email accounts in a very short amount of time ?
Creating 100+ accounts on your own server would be pointless. It's usually the originating server and isp and/or the email's content that causes it to be flagged as spam. Creating 100+ accounts elsewhere MAY work, but then each of those other servers may also be considered as a spam source and any mails you send from that particular account will go missing as well.
You can check your mail server's logs to see if the mails get dumped by the receiving mail server. Some of them will do the filtering right at the initial connection/send attempt. However, some will pretent to accept the mail (and you see a 200 OK acceptance message), but then toss the mail in the trash automatically. In this case, you'd nave no idea what happened, as everything would appear to have worked fine.
I had set it up easily using Yahoo Mail Plus. They had the feature of Disposable Email Accounts. You can create 500 of them !

Sending emails to multiple recipients - best practices

My application server needs to notify users about some events via email. Usually there will be between 10-100 users to whom the notifications should be sent, but there may be a few cases where there may be a bit more (I don't think it will ever be more than 1000).
What is the best practice in such cases? Should I send a single email per user or one email with all users as recipients or group users and send one email for each group (for example 1 email for 10 users)? If it makes any difference I may add that I am using System.Net.Mail to send emails.
Thanks in advance for your suggestions
Lukasz Glaz
You should send one e-mail per user.
The alternatives either involve putting e-mails in BCC (which will increase your chances of having your mails flagged as spam), or revealing your user A's e-mail address to user B, where user A and user B are in the same "group".
You need to check with your smtp server manager - to avoid being blocked.
if you own the smtp server, than this is not a problem.
I think the best way is to send them in bulks of 50 recipients per message (it will be a little faster than one by one).
I wouldn't definetly put all recipients into a To: field. Even from one place. It's just not a good practice to show other's addresses. And it generates a problem when someone hits "Reply All" and suddenly mails all others with his crap :)
If you own the smtp server, and your application server -> smtp server connection isn't slow, I would just send every mail individually, with each single recipient in To: field. It just looks much less spam'ish then getting a mail with empty (or some bogus) To: field and being in BCC only.
Other advantage is the person recieving your mail will know what email address is used. I got plenty of them, use different ones in different places, and it helps to be able to see which one I used on which site (sometimes I need to use this address for password reset / login, and I forgot, and if all mails had me in BCC, I'm screwed). This is from your user's perspective.