In general, no way.
This "wonderful mail() command" actually requires configuration, but in unexpected places.
- On * nix, it uses the system
sendmail , which is usually configured by the administrator before putting the server into operation. - On Windows, it sends a letter through an SMTP server, the details of which need to be specified in the PHP configuration.
If none of the above is configured, then mail() will not be able to send anything. So it will be necessary to authenticate in any case (unless you find any public SMTP server, the letters from which get into spam with a probability of about 100%).
So you will have to use one of the extensions "in which you need to log in by key or enter your email to send". Because ultimately it ends. There is no magic. mail only abstracts from specific sending services, allowing you not to sweat about the authentication procedure in the code sending the letter.
Nothing prevents you from making a separate mail sending module with a given configuration file and one mail function sticking out.
It is in practice. Theoretically , the opportunity is there.
The global e-mail system somehow works, the servers exchange letters among themselves. This is not authentication through authentication.
To do this, you need to get the domain from the recipient's address and request the DNS record from the DNS. This will tell you which mail server delivers messages to the specified address. Then send a letter to him directly. This is implemented in packages like directmailer .
Why is it usually not viable in practice? Spam More precisely, countermeasures against spam. With a very high probability, any large providers of letters sent in this way will go to spam as “not credible”. This can be managed, but difficult.
That is why many people use large postal services, which have already resolved problems with trust, and are fighting with their services actively enough to send spam to other services to trust them.