mail(). The function will kick sendmail, which just put a message in a queue for later processing by the daemon (sendmail, qmail, postfix, you name it) and quickly return control to the application. While installing an SMTP connection with a remote host of type of Yandex and Google — quite brake operation, as practice shows.