This mechanism for the sending of emails requires that the email address that the email originates from is authenticated - that is the email address must exist and the password for that account needs to be available in order for the email to be able to be sent. As the email headers this generates identifies the originating email address that was used for authentication this means that the email is confirmed to have been sent by a specific email account. Note that the from address identified within the email headers need not be the same as the originating email address but both will appear in the audit trail above the email content making it possible to clearly identify where the email really came from.
Another aspect to sending emails using SMTP is that SMTP queries the recipient addresses as a part of the process and will return an "undeliverable" email response if an email address that the email is being sent to does not exist. This response gets sent to the originating email address and not the from email address. This means that using authenticated SMTP to send emails allows you to tell which emails are actually delivered and which are being sent to addresses that don't exist.
SMTP authentication can be used with both desktop email programs and with online email processing, it is just a matter of configuring the particular process that sends emails to use authenticated SMTP.
Since authenticated emails have information added above the email headers that confirm where the email came from, email providers can use this information to help them to decide what emails are likely to be legitimate and hence should be delivered and which are likely to be spam. This provides another way to help eliminate spam emails from being delivered. If all ISPs and hosting providers were to require the use of authentication when sending emails then this could go a long way toward eliminating spam as they could then simply require that any emails being received be authenticated and discard any that are not. For spam to have any chance of being delivered in that situation the spammer would need to identify themselves and so would make finding them and shutting them down much easier.
Unfortunately not all ISPs and hosting providers require this. Also there are several other authentication methods that some providers are using. These various authentication methods when used together could make it even easier to ensure that spammers identify themselves clearly but again not all providers use these authentication methods. In fact the biggest problem in resolving this to block spammers is that no one can agree on which single or combination of authentication methods should be adopted for the purpose.