ClassGo

Mail

Synopsis

Description

Mail sends through one of the mail servers the host configured, selected by $name; new Mail selects "default". The credentials stay with the host: a script names a server and never spells, or reads back, a host, a username or a password. The constructor throws when $name is not a configured server.

$mail = new Mail;              // the "default" server
$mail = new Mail("marketing"); // a server the host named
$mail->send("hello@example.com", "Subject", "Body");
$mail->send("hello@example.com", "Subject", "Body", "<p>Body</p>", "support@example.com");

Mail is a class phpscript declares.

$object = new Mail($names);

Methods

public function send(string $recipient, string $subject, string $body, string $html, string $reply_to): void

send sends an email through the server this client names. $body is the plain text; a non-empty $html travels beside it as the alternative a mail client prefers, and a non-empty $reply_to, one address, is where a reply goes. It throws, sending nothing, when $reply_to is not one address. The runtime injects the context and a script calls $mail->send($to, $subject, $body, $html, $reply_to), the last two optional.

The go method Send.

Binding

Go type
github.com/titpetric/phpx/stdlib/ps/mail.Mailgodoc
Package
github.com/titpetric/phpx/stdlib/ps/mailgodoc

See also