PHP 8.4.0 RC3 available for testing

imap_mail

(PHP 4, PHP 5, PHP 7, PHP 8)

imap_mailSendet eine E-Mail-Nachricht

Beschreibung

imap_mail(
    string $to,
    string $subject,
    string $message,
    ?string $additional_headers = null,
    ?string $cc = null,
    ?string $bcc = null,
    ?string $return_path = null
): bool

Diese Funktion ermöglicht das Senden einer E-Mail mit korrekter Behandlung von Cc- und Bcc-Kopffeldern.

Die Parameter to, cc und bcc sind Strings, die als Adresslisten gemäß » RFC822 interpretiert werden.

Parameter-Liste

to

Der Empfänger der Nachricht

subject

Die Betreffzeile der Nachricht

message

Der Inhalt der Nachricht, siehe imap_mail_compose()

additional_headers

Ein String mit zusätzlichen Kopfzeilen

cc

bcc

Die in bcc angegebenen weiteren Empfänger erhalten die Nachricht, werden aber nicht im Nachrichtenkopf aufgeführt.

return_path

Die Rückgabeadresse für den Fall, dass die Zustellung der Nachricht fehlschlägt. Diese ist nützlich, wenn PHP als Mail-Client für mehrere Benutzer verwendet wird.

Rückgabewerte

Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.

Changelog

Version Beschreibung
8.0.0 additional_headers, cc, bcc und return_path sind nun Nullable-Typen.

Siehe auch

add a note

User Contributed Notes 1 note

up
1
Patanjali
6 years ago
In response to Mathias Rav's comment.

While imap_mail might have this $rpath bug, it is hardly comparable to mail, because mail only uses the default send mail server account, and not a real mailbox, which you can programmatically interrogate and clean up.

Using the imap extension allows proper mail management and operation, like users not getting the cryptic server account name followed by 'on behalf of' the 'From' address that mail sourced emails show on some recipient clients.
To Top