Gmail store single copy of mail for both sender and receiver? - sql

If I am sending mail from Gmail to other Gmail user does it store single copy or multiple copy of mail for each?
If its saves single copy what if sender delete his email?
I am creating database schema for this kind of application.

If I am sending mail from Gmail to other Gmail user, does it store single copy or multiple copy of mail for each?
We don't know. And it doesn't matter.
What if sender delete his email?
You can't expect an email to disappear from recepients' inboxes simply because sender deleted it on their end. This is not how email works.
For generic messaging application, when there's no other domains (you control all messages), you can implement such behaviour, if needed. However, some functional requirements of your app may make it very hard. For one-on-one messaging, you can follow advice from Sunil's answer, for example. But what if message has 5 recipients? How many flag columns do you put on messages table? What if message has 200 recipients? Common sense dictates that at least some of information must be duplicated for each recipient and, therefore, is shielded from sender's activity (deletion and whatnot).

How does Gmail do it? Who knows? Who cares? The question is what meets YOUR requirements.
If you are building some kind of messaging system where all messages live on a single database, then it makes sense to just have one copy of each message. You have a separate table or tables to link each message to the relevant users. Like you have a "message" table that holds message text, a "user" table that holds information about each user, and a "user-message" table that links users to messages, containing the user id, message id, a field to identify whether this is the sender or the receiver, maybe other data. If a user deletes a message from his mailbox, you delete the user-message record. Perhaps when the last user-message record for a given message is deleted, you then delete the message.
If there's a reason to keep history, records may not really be deleted but instead marked as deleted.

Related

Pushbullet API - Is it possible to update a contact's email address?

You can create a contact and specify email, but the only option for updating a contact seems to be name. Is it possible to update a contact's email?
This would be preferable to making the user delete the contact and then add it again it with a new email, in cases where they mistype the email (or if the address changes, I suppose).
Nah, there's no way to change the email address. You can programmatically delete the contact rather than making the user delete them, I think this is what the website did.
Just a note, as I mentioned on this other thread (Add contact to pushbullet with the api): the official apps use the (not yet documented) /v2/chats objects instead of contacts
You can update a contact, but the exact rule is vague:
Any non-contact data will not be modified.
I use it to change a contact's primary email address, but sometimes it works, sometimes not, and it seems to be related to how the email found its way into the user's google contacts.
I suspect if an email address was imported, there's an issue, but I have spent a lot of time and still have no real idea.
In fact, my implementation is horrible. I first store the current email addresses for a contact. Then I do an update to clear them out. Then I do another update to add them back, but this time with the primary=true flag set on the new primary email. Can't get it to work as in the reference, whereby a single update transaction should work.

Insert record through email on rails

I have developed a messaging system on rails3.As per the requirements, when User A commented any message to UserB then the message will be stored on the DB, also email notification will be sent.
Now my requirement is When User B replying the email notification though mail with some messages, it should get inserted on the DB.
This is a rather complex task compared to sending emails. Essentially, you'll have a few steps:
Set up a receive method in your mailer
Set up your email server to forward emails to your app
Handle processing the email content
Save into the database
Probably the most straight-forward explination of the entire process can be found in this rails guide.

Storing selected emails from outlook in SQL Server by forwarding

This may not be possible but just wanted to see if anyone could point me in the right direction.
I am building a system that needs to store all corespondence between the company and each client.
Is it possible to forward an email from outlook to a certain email address that will then store this email in an SQL server.
Thanks for any help.
You can try this Outlook Add-on: www.geniusconnect.com
Link Sent Items Outlook Folder to your table and check "Auto Save" option. This will save sent items automatically to DB.
You could write an outlook add-on using .NET that inserts the contents of the e-mail into a SQL Server table and the sender information.
Try looking at it the other way around. Build your email in the database first, then have a separate process actually send out the emails. After every successful send, you mark database email record as "sent".
I recommend an asynchronous approach. As emails are to be sent, they are generated and stored in an EmailQueue table. Another process monitors the EmailQueue table and sends out the emails as it discovers them. This way any delay with the actual sending of email will not interfere with the process that is generating the emails to be sent.

detect that an email is sent to a mailing-list

My application sends mails containing an authentication token. The user which receives the mail clicks on a link and is directed to a webpage. The app recognizes him.
The problem is that sometimes the mail is sent to a mailing list instead of a personal address. Then several people come on the page and override each others' actions.
There are 2 ways I think I could solve this :
detect that the email address is a mailing list before I send the mail
include the final recipient address in the link in the email.
Is any of the 2 possible ?
No.
The recipient can tell if the message came from a mailing list (if the list follows the right guidlines), but the sender can't.
There is no way for the sender to modify the body of an email dynamically based on the final recipient.
David's answer is correct. Though, depending on your context you may find the following idea useful:
You might be able to record the number of clicks per email sent out using that token and just specify a threshold. If the number of times the auth token exceeds it, flag the recipient as a mailing list and exclude them from future mailings.

Email Synching into Custom App

How have people intergrated custom CRM type applications with email?
I have a Access 2003 front-end application with a SQL Server 2005 backend. One CRM
part of the application tracks the activity with the customer in a traffic
log table. Sometimes the salesstaff has communication with their customer
using email instead. What do people do to synch this up with an application?
I was thinking about creating a form to enter the initial message, so I
could save it into a table and then have the system generate a email, of
course, this doesn't handle the email communication after the initial email.
Thanks
What you need to do is setup your domain name with a free google apps account. Your sales staff can still use the clients of their choice, but since they are essentially using custom gmail accounts, every single email that they send and receive will be recorded in a nice and neat transactional format in the gmail interface. Since your sales staff is always online, they will always have access to every message they ever sent. If you want to have access to the emails, you can set it up that every single message that gets sent are automatically blind forwarded to your account. Filters can be set up to automatically tag and archive them, so you will not be overwhelmed, but you will still be able to search them. Google Apps will also give you a central contact directory similar to outlook/exchange.
Here are a few options for you:
Use web forms for all communications. When a message is sent out, the only thing it includes is a link back to the site. Responses are sent the same way.
Setup an email alias that your sales staff Cc's when they want their correspondence to be tracked. Your app would periodically read a POP mailbox, and record the traffic. Customers would have to remember to Cc the same email box for the traffic to be remembered.
Establish a single common email box, such as sales#domain.com. All outgoing mail is marked as being from that account, so all replies will go through it. To send mail, sales staff uses a web form. Messages are tagged with a key that associates them with a particular customer. Putting the key in the subject header usually works OK (that's how many support ticket management systems work, for example). Replies from customers keep the tag. Your app then reads an associated POP mailbox, parses out the keys, and stores the email accordingly.