Why email client need a SMTP relay server? Is that neccessary? - email

When setting-up my mobile email client, I usually need to enter the SMTP relay server domain name, but why my email client need a SMTP relay server at all?
I think it can directly talk to the smtpd server (e.g. postfix) from which domain the destination Email address is, by looking up the DNS MX records. And send directly to it, why not?
Actually I have another confusion, if a smtpd server use SMTP AUTH, then how can a rely server elsewhere rely a mail to it? The rely server simply don't have the username and password necessary to transfer that mail.

Email clients use SMTP relay server to
simplify email sending (e.g. to avoid repeating delivery attempts by email client)
avoid being mistaken for spammers.
Direct email sending might be a reasonably simple option in ancient pre spam past.
SMTP AUTH is used (mainly) with email client to email server communication. SMTP server to SMTP server communication could not require SMTP AUTH without prohibiting email from "strangers". SMTP AUTH allows to accept messages from trusted clients (customers) even from IP addresses that otherwise would be blocked by DNSBL (e.g. DUL ranges).

A SMTP server these days does many more things:
Queues the emails and works on delivering them: this may not matter if you just send a single email here and there, but it's a different thing for a 500k recipients newsletter.
Retries messages than can not be delivered immediately (e.g., slow receiving server), and eventually bounces them if they cannot be delivered. According to RFC 5321 once a SMTP server accepts responsibility of an email message, it must not lose it but either deliver or return (bounce) it.
DKIM sign the message.
Route emails to go out from different sending IP addresses and host names, for deliverability purposes. (Email reputation is based a lot on sending IP addresses.)
Throttle delivery of large amounts of emails to avoid being seen as an aggressive sender and getting blocked.
Optionally, archive (or bcc) all outgoing email, for documentation or compliance purposes.
Of course you can also do all these things in your email sending application and then you don't need a SMTP server, then you wrote an SMTP server.

Related

How to get smtp from mx records?

I am trying to get the SMTP of an email from the MX records. For instance, nslookup if I type in outlook.com what I get is outlook-com.olc.protection.outlook.com but actually the SMTP is smtp-mail.outlook.com. How can I get this record smtp-mail.outlook.com from the MX records rather than google for each domain what their SMTP is?
Even for 163.com the mx record I get is 163mx03.mxmail.netease.com now I have to google what is the smtp for netease.com and I figured out from internet that it is smtp.ym.163.com.
Is there a simpler or a standardised procedure to get this output? I even tried sending a mail from that email and in email header also there is no SMTP provided like this.
In any mail delivery from a#domain1.com to b#domain2.com, there are generally* two SMTP servers used. The first is a#domain1.com’s submission server, used for a to submit mail to other people. The second is domain2.com’s destination** server, used to receive messages for domain2.com’s users. So an email goes from a’s email client to a’s submission server. The submission server relays it to domain2.com’s destination server, where b can then retrieve it.
The MX record represents the destination SMTP server, that other providers should use to send mail for that server’s users. For example, the MX for outlook.com is the SMTP server your server would use to relay messages to email addresses xyz#outlook.com. It is not the server outlook.com’s submission users use to send mail to other people.
Submission servers can theoretically be stored in DNS SRV records, but this isn’t widely deployed. Mail Clients usually guess using heuristics (try smtp and mail.domain2.com) or using databases that have been collected (eg, thunderbirds ispdb), or configured by the end user.
For example, thunderbird documents their autoconfiguration methods. It is a combination of a database, a special web server at autconfig.domain.com, admin provided configuration file, and guessing.
*: in more complicated setups, even more can be used (like internal submission and edge servers), but this is the baseline.
**: this is more precisely called a relay server, I use destination as a more precise name for the final relay server.

What is the advantage of having a client-side MTA in the SMTP network?

A standard email delivery uses at least 2 SMTP connections:
From the sender to the sender's MTA
From the sender's MTA to the receiver's MTA
and requires at least two SMTP servers, the first one being a relay.
Instead of this routing / relay infrastructure, the client could directly send its messages to the receiver's MTA, e.g. bypassing the relay step.
I get that there are some advantages, such as :
authentication delegation and greylisting: The receiver can trust the sender's MTA to authenticate the sender, so it is not necessary to be able to authenticate the sender.
advantages of the client-server architecture: the client's MTA being a server, it can provide easily more functions (be more easily secured etc...) than a client application. For example, back when being connected to the Internet was costly, the MTA server could mutualise the Internet connection.
But it seems these are only advantages, and not a design constraint today (embedding a library on the client is not a problem anymore).
Are there some reasons that require using a client MTA today, or is it because of the technological inertia of these protocols (e.g. the difficulty to change a standard that is well established and implemented)?
There are several compelling reasons to use a client-side MTA. Here are two:
1) The sending MTA does the DNS queries to figure out which mail server it needs to contact to reach the receiver's MTA.
2) If the sending MTA can't reach the receiver's mail server, it can retry delivery later on. Or, it could fall back to using one of the receiving domain's higher-distance MX records (if any exist).
You could always write this functionality in your mail client, but if you do that, you are well on your way to making your mail client an MTA.
There are other reasons. For example, if the sending MTA handles mail for multiple senders, it can batch emails: if it has multiple emails destined for gmail addresses, for example, it can send them all over the same connection. That way it doesn't have to open and shut down a connection for every single email. This becomes even more advantageous if it needs to negotiate TLS and/or AUTH.
Your suggestion is far too complicated for most users in "spam era".
It may be worth the effort required for some but sadly mostly for spammers.
Sending via "sender MTA/SMTP server" grossly simplifies email sending, both troubleshooting by sender and email client implementation.

Is there a reliable way to send email without having the senders smtp?

My application will be used in a manner that the user is remote from his computer running the application, receiving data via text messages sent periodically from the PC. Im sending the text message via email, using the number#carrierdomain.com. To simplify determining the user's smtp server, I've been sending the message using the destination phone carrier's smtp, instead of the whatever may or may not be available at the PC. This has worked so far with AT&T and T-Mobile, but not Verizon, as they have discontinued their smtp service.
I'm using mailsend v1.15 http://www.muquit.com/muquit/software/mailsend/mailsend.html
but Im open to alternatives.
I do have a less than ideal workaround, which is to use google or hotmail's smtp, but that requires a login/pass.
If I can send the text through regular email, using outlook, it works. I've looked at outlooks smtp logs, but that doesn't really help.
If its not being sent to a Verizon smtp server, how does it get routed, and is it something that my application can use?
Is there a reliable way to send email without having the senders smtp?
Theoretically, any smtp server can send your e-mail. However, due to the overwhelming amount of spaming on the internet, pretty much every isp has locked down their smtp server and will not allow anonymous relaying of e-mail.
If you do have the outlook client on the box you are sending the e-mail you can look at using one of the Outlook APIs:
http://msdn.microsoft.com/en-us/library/gg608200.aspx
to send the e-mail message. You are using the outlook configuration then and don't have to worry about it your code.
As long as an SMTP server is configured to allow relay from a remote domain then you can use it send email from/to virtually any address. There are downsides, however, to using any SMTP server to send an email from a specific domain - the most notable of which is that the recipient's domain will likely flag the message as spam because the domain of the SMTP server is different from that of the sender's email address.
There are other non-email APIs that can be used to send text messages, if that is something you're willing to consider. Check out:
Tropo (http://www.tropo.com)
Zeep Mobile (http://www.zeepmobile.com)
Best of luck to you.
Impossible. SMTP is the Simple Mail Transfer Protocol, without this is impossible to access to another account with Email format. You can make a php mail where you don't need to have smtp, but your access will be limited, not all ESP / ISP will allow you to delivery those emails, because they need to identify you using your SMTP and MX Lookup (Reverse MX A records) from your server. It exists more ways, but are 100% SPAMMERS and HACKERS methods and I don't recommend to use them.

send email using dns server

Am developing and newsletter email software in vb.net for a friend, and he has asked me to add option to send email using dns servers,
How do i send an emai using dns server without smtp or imap?
Send email "using DNS servers" still uses SMTP. And it's generally a bad idea. Here's what it's about:
Usually, an email app (your own, Outlook, etc.) send mail using SMTP or similar protocol to a configured mail server. It could be a company's own server, or an ISP's server, or something like that. The mail may pass through various outgoing mail servers on its way out of an organisation, but at some point it hits a "boundary server" (There are pretty names for all these different types of server, but they're not important right now.)
This boundary server uses DNS to find the recipient's mail server and then sends the message (using SMTP) to that server. (I have omitted the details on purpose)
Sending email "using DNS" means that your app acts as a boundary server. It uses DNS to find the recipient's mail server and then sends the mail directly - rather than using any outgoing servers.
It's a bad idea for two reasons.
More and more ISPs block SMTP traffic that doesn't pass through their outgoing servers
More and more incoming servers validate the boundary server using various techniques. Your app is not likely to be accepted by these servers
Both of these issues are anti-spam countermeasures, so using this technique makes you look like a spammer, leaves many of your messages blocked, and is likely to get your IP address blacklisted.
Hopefully you can explain this to your friend so that they will understand that the "normal" way of sending mail is the only way to ensure that they don't get listed as a spammer.

What protocols and servers are involved in sending an email, and what are the steps?

For the past few weeks, I've been trying to learn about just how email works. I understand the process of a client receiving mail from a server using POP pretty well. I also understand how a client computer can use SMTP to ask an SMTP server to send a message. However, I'm still missing something...
The way I understand it, outgoing mail has to make three trips:
Client (gmail user using Thunderbird) to a server (Gmail)
First server (Gmail) to second server (Hotmail)
Second server (Hotmail) to second client (hotmail user using OS X Mail)
As I understand it, step one uses SMTP for the client to communicate. The client authenticates itself somehow (say, with USER and PASS), and then sends a message to the gmail server.
However, I don't understand how gmail server transfers the message to the hotmail server.
For step three, I'm pretty sure, the hotmail server uses POP to send the message to the hotmail client (using authentication, again).
So, the big question is: when I click send Mail sends my message to my gmail server, how does my gmail server forward the message to, say, a hotmail server so my friend can recieve it?
Thank you so much!
~Jason
Thanks, that's been helpful so far.
As I understand it, the first client sends the message to the first server using SMTP, often to an address such as smtp.mail.SOMESERVER.com on port 25 (usually).
Then, SOMESERVER uses SMTP again to send the message to RECEIVESERVER.com on port 25 (not smtp.mail.RECEIVESERVER.com or anything fancy).
Then, when the recipient asks RECEIVESERVER for its mail, using POP, s/he recieves the message... right?
Thanks again (especially to dr-jan),
Jason
The SMTP server at Gmail (which accepted the message from Thunderbird) will route the message to the final recipient.
It does this by using DNS to find the MX (mail exchanger) record for the domain name part of the destination email address (hotmail.com in this example). The DNS server will return an IP address which the message should be sent to. The server at the destination IP address will hopefully be running SMTP (on the standard port 25) so it can receive the incoming messages.
Once the message has been received by the hotmail server, it is stored until the appropriate user logs in and retrieves their messages using POP (or IMAP).
Jason - to answer your follow up...
Then, SOMESERVER uses SMTP again to send the message to RECEIVESERVER.com on port 25 (not smtp.mail.RECEIVESERVER.com or anything fancy).
That's correct - the domain name to send to is taken as everything after the '#' in the email address of the recipient. Often, RECEIVESERVER.com is an alias for something more specific, say something like incoming.RECEIVESERVER.com, (or, indeed, smtp.mail.RECEIVESERVER.com).
You can use nslookup to query your local DNS servers (this works in Linux and in a Windows cmd window):
nslookup
> set type=mx
> stackoverflow.com
Server: 158.155.25.16
Address: 158.155.25.16#53
Non-authoritative answer:
stackoverflow.com mail exchanger = 10 aspmx.l.google.com.
stackoverflow.com mail exchanger = 20 alt1.aspmx.l.google.com.
stackoverflow.com mail exchanger = 30 alt2.aspmx.l.google.com.
stackoverflow.com mail exchanger = 40 aspmx2.googlemail.com.
stackoverflow.com mail exchanger = 50 aspmx3.googlemail.com.
Authoritative answers can be found from:
aspmx.l.google.com internet address = 64.233.183.114
aspmx.l.google.com internet address = 64.233.183.27
>
This shows us that email to anyone at stackoverflow.com should be sent to one of the gmail servers shown above.
The Wikipedia article mentioned (http://en.wikipedia.org/wiki/Mx_record) discusses the priority numbers shown above (10, 20, ..., 50).
You're looking for the Mail Transfer Agent, Wikipedia has a nice article on the topic.
Within Internet message handling services (MHS), a message transfer agent or mail transfer agent (MTA) or mail relay is software that transfers electronic mail messages from one computer to another using a client–server application architecture. An MTA implements both the client (sending) and server (receiving) portions of the Simple Mail Transfer Protocol.
The terms mail server, mail exchanger, and MX host may also refer to a computer performing the MTA function. The Domain Name System (DNS) associates a mail server to a domain with mail exchanger (MX) resource records containing the domain name of a host providing MTA services.
You might also be interested to know why the GMail to HotMail link uses SMTP, just like your Thunderbird client. In other words, since your client can send email via SMTP, and it can use DNS to get the MX record for hotmail.com, why doesn't it just send it there directly, skipping gmail.com altogether?
There are a couple of reasons, some historical and some for security. In the original question, it was assumed that your Thunderbird client logs in with a user name and password. This is often not the case. SMTP doesn't actually require a login to send a mail. And SMTP has no way to tell who's really sending the mail. Thus, spam was born!
There are, unfortunately, still many SMTP servers out there that allow anyone and everyone to connect and send mail, trusting blindly that the sender is who they claim to be. These servers are called "open relays" and are routinely black-listed by smarter administrators of other mail servers, because of the spam they churn out.
Responsible SMTP server admins set up their server to accept mail for delivery only in special cases 1) the mail is coming from "its own" network, or 2) the mail is being sent to "its own" network, or 3) the user presents credentials that identifies him as a trusted sender. Case #1 is probably what happens when you send mail from work; your machine is on the trusted network, so you can send mail to anyone. A lot of corporate mail servers still don't require authentication, so you can impersonate anyone in your office. Fun! Case #2 is when someone sends you mail. And case #3 is probably what happens with your GMail example. You're not coming from a trusted network, you’re just out on the Internet with the spammers. But by using a password, you can prove to GMail that you are who you say you are.
The historical aspect is that in the old days, the link between gmail and hotmail was likely to be intermittent. By queuing your mail up at a local server, you could wash your hands of it, knowing that when a link was established, the local server could transfer your messages to the remote server, which would hold the message until the recipient's agent picked it up.
The first server will look at DNS for a MX record of Hotmail server. MX is a special record that defines a mail server for a certain domain. Knowing IP address of Hotmail server, GMail server will sent the message using SMTP protocol and will wait for an answer. If Hotmail server goes down, GMail server wiil try to resend the message (it will depend on server software configuration). If the process terminates ok, then ok, if not, GMail server will notify you that he wasn´t able to deliver the message.
If you really want to know how email works you could read the SMTP RFC or the POP3 RFC.
All emails are transferred using SMTP (or ESMTP).
The important thing to understand is that the when you send message to someguy#hotmail.com this message's destination is not his PC. The destination is someguy's inbox folder at hotmail.com server.
After the message arrives at it's destination. The user can check if he has any new messages on his account at hotmail server and retrieve them using POP3
Also it would be possible to send the message without using gmail server, by sending it directly from your PC to hotmail using SMTP.
Step 2 to 3 (i.e. Gmail to Hotmail) would normally happen through SMTP (or ESMTP - extended SMTP).
Hotmail doesn't send anything to a client via POP3. It's important to understand some of the nuances here. The client contacts Hotmail via POP3 and requests its mail. (i.e. the client initiates the discussion).