PHP function mail()

The mail() function sends an e-mail message through the default server configuration. To work correctly, the function needs to be enabled on the server and the mail server needs to be configured for sending.

The function is for sending only. You have to sort out receiving messages at the mail server level. For example, download messages regularly using IMAP or POP3 protocol.

I strongly discourage the use of the function at the moment, because the programmer has to take care of everything himself (for example, send the correct headers, or set the encoding).

Much better is to connect via SMTP server.

Using

php
mail ('jan@barasek.com', 'Subject', 'Email text... ');

The first parameter gives the recipient's address, the second the subject and the third the message text. The fourth (optional) parameter gives the additional configuration of the message.

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.