detect that an email is sent to a mailing-list - authentication

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.

Related

Suppression list on Amazon SES not blocking messages with multiple recipients

I use an account-level suppression list on Amazon SES. I have noticed that if I send an email message to an email address which is in the suppression list, for example, name1#domain.com, the message is not blocked by the suppression list if the "to" field of the email message has more than one recipient email address. Something like this:
To: name1#domain.com, name2#anotherdomain.com
The email name1#domain.com is in the suppression list and name2#anotherdomain.com is not.
In this case, the email is delivered to both email addresses, even though name1#domain.com is in the suppression list. The suppression list only blocks my messages when the email is sent to a single email recipient.
It looks like the suppression list only blocks messages sent to a single email address. I could not find any documentation about this, but my tests show this. Has anyone noticed this also? Am I missing something or is this the expected behavior?
I am sure that the email address name1#domain.com is in the suppression list, I have checked it via web console and via aws sesv2 list-suppressed-destinations.
There are several things to check it. First of all, you have checked that only in case of two email addresses - lets name them A and B, if one of them is on suppression list and another one not, the email is sent.
Check another version - what if both A and B addresses are on suppression list - is the mail still sent? I would argue that it is not, even though it might be accepted through SES, it might not be sent.
Coming back to your part - when you send an email and add to the TO headers - it is one mail that is being delivered to multiple people - so in order to be consistent, SES is not modifying email headers, however it sends it - and one of the recipients is one on the suppression list and another one not, so both of them receive it as only one mail is being sent. If I were you, I would check adding the same addresses to the BCC - as for this part, the mail is being copied and in your case, there would be two mails sent (one with BCC to A and another one to B). I could assume that this part could be handled and blocked by SES.

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

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.

Preventing an email from being sent to Outlook's Junk folder

I'm writing an application that creates a word document and emails it to a user from our shared mailbox. The code works fine, however the message is delivered to the Junk folder instead of the Inbox.
I believe this is because it's coming directly from the email address (mymailbox#company.com), instead of the mailbox name in our Global Address List (My Mailbox).
Is there a way to get VB.Net to recognize my Global Address List so I can send directly from the mailbox name; or is there another solution to this problem?
You can set the "from" address in mailmessage.from to the proper email address. However, the "from" address is usually not enough to get an email sent to the spam folder.
There are several steps you can take to make it more likely your email gets through. The links in the comment above Rachel Gallen cover these pretty well.
http://www.allspammedup.com/2009/09/7-ways-to-prevent-your-emails-being-blocked-as-spam/
http://www.interspire.com/content/2006/09/28/improve-your-email-delivery-rates/
Just why something ends up in the junk mail is something set by the recipient's email client and/or ISP and not something you have control over. You may be able to maximise your chances of appearing to be non-spam by making your email have fewer spammy characteristics - if you could re-cast your sending system to create the message as an email rather than an attachment this may help.

Mailsystem Failure Delivery - Custom subject

When a mail is bounced it has a standard subject.
Is it possible to change with a custom subject or the subject which we gave or with a dynamic subject?
I am building a simple system in php to count all send and not sent mails with the help of bounced mails.
So i need to parse the body of the bounced mail to find the email address to which the mail was not sent.
If there could be any other less overhead option then that could be nice. We can reduce the processing time to parse.
You can send a custom x-mail-id header or use the standard Mail-ID header. You store in a table a map of the id to email addresses.
From there it is simple to find out which email bounced by matching the id to the email address in your table.
That subject could be generated by any server along the path your mail message takes, so I'd say no, you can't change that.

Track bounced back newsletter emails

I've built a newsletter system which tracks:
Openings
Link clicks
Unsubscriptions
However, I need to find a way of tracking which newsletter emails 'bounced back'.
Has anyone done this before and whats the best way of doing it?
When sending the mail via SMTP you supply the FROM command which is sometimes referred to as the 'Sender' or 'Envelope Sender'. This is separate from the From: header in the email itself. What you want to do is to create a 'bounced' mailbox and set that as the 'Sender' for the email. If there is a bounce, then most mail servers will send a (NDR) notification back to this sender.
Then you need to periodically check this mailbox for NDR's and parse them for the original recipient and if it was a hard or soft bounce. There are various libraries that can do this for you such as ListNanny