With regard to this question in which I was using a barebones method to find the mail provider of a particular user, since I was using Amazon SES
to send mails, but, am also quite new to it, I was wondering if Amazon SES
provides a way to do so? Does Amazon SES
give a way(api/service etc) to find the mail provider of the user that I'm sending email to?

- 241,921
- 22
- 380
- 470

- 87
- 2
- 16
-
but it does help figure the mail server? – BumbleBee Jun 23 '21 at 12:48
-
1The SES API does provide a lot of information through its API. To see a list of supported functionality - see here: https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/ses/SesClient.html – smac2020 Jun 23 '21 at 12:51
-
You can call this method to determine a list of Identities for example: https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/ses/SesClient.html#listIdentities-software.amazon.awssdk.services.ses.model.ListIdentitiesRequest- – smac2020 Jun 23 '21 at 12:53
-
@smac2020 , if not using SES, do you know how to find the mail provider from mail? The link in the previous question describes it: https://stackoverflow.com/questions/68086096/finding-which-provider-is-responsible-for-the-mail-domain?noredirect=1#comment120343155_68086096 – BumbleBee Jun 23 '21 at 13:04
2 Answers
Your question is a little vague in exactly what outcome you are trying to achieve with this data.
I am unsure if you are familiar with how mail delivery works on the Internet. My apologies if this is not news to you. At a basic level, email is simply ferried from machine to machine (SMTP server to SMTP server) until it find 'the' server that eventually your mailbox resides on. (This is a relatively gross oversimplification in modern times, but still true).
The first step is you get the message to a SMTP server with instructions to deliver the message, typically with a destination email address. Now, if you are using AWS SES APIs, there is the additional step that before it gets to the initial SMTP server, you first exercise the SES API which in turn ferries that message to Amazon's SMTP servers.
Now, the first SMTP server needs to know where to send it to. This is typically done by executing a DNS query on the destination domain and looking up the MX record. (More information on MX Records here). The MX record will contain an entry (or list of entries) which tell other SMTP servers how to contact that SMTP server for the domain. This is likely where your question is getting at - somehow identifying which 'provider' is in use. In current times, it is very common a large managed service provider like office 365 or similar runs that service for a domain. This is usually programmed into the client's MX record, which is the 'giveaway' that they are using O365 or whatever. However, plenty of domains run their 'own' servers and there is no technical reason preventing such. (Small lie: Since the beginning of time SPAM has been there and the 'reputation' of sending SMTP servers has been quite important in deterring SPAM, or at least was at some point in time. This is one of the reasons that AWS is so picky on you not sending unsolicited emails - it would count against the reputation of their SES SMTP servers sending it and they need it to be 'good' so they don't wind up on block lists at the Amazon level)
Here is the next complication and likely why even if an initial lookup was performed, the data cannot be guaranteed to give you what you want. Since the SMTP service is inherently hop-to-hop, there is nothing stopping the MX record at the DNS domain from merely being a proxy to another set of SMTP servers. Remember, that SMTP is one of the oldest protocols there is on the Internet and its simplicity is what made it functional before all of the infrastructure we have in place today. A SMTP server takes commands from users (or other SMTP servers) and then does its part to pass the message on closer to the actual user.
I am unsure if your end functionality would somehow modify the message sent based on the destination, or if perhaps it wouldn't send at all. Both are not supported by the AWS SES APIs (link). (BTW, it would have to be at the AWS SES APIs that did this, since this functionality simply isn't in the vocabulary of SMTP). You can look at the AWS SES API reference for what it can do, and what it can offer, but if modifying the message before delivery based on provider is what you want there is no current function in that.
Links:
https://en.wikipedia.org/wiki/MX_record
https://docs.aws.amazon.com/ses/latest/APIReference/Welcome.html

- 2,238
- 2
- 13
- 35