Send mail with PHP (basic)
With PHP, you can quickly and easily send emails. Whether contact, newsletters, or simply so. This is the PHP function mail (); available. The following parameters are simple to dispatch an e-mail necessary:
mail (recipient, subject, message);
1. Parameters: The e-mail address or the name + email address
Syntax:
mail@example.com
or
First name last name <mail@example.com>
2. Parameters: The subject of the email to be sent
Note: The subject must not contain line breaks!
3. Parameter: The contents of the e-mail may be stated here. Newlines must be equipped with “\ n” (line feed) and should be after 70 characters, so that the content in all email applications will be displayed correctly.
Tip: An automatic break after 70 characters is achieved by modifying the previous message with the function wordwrap ();
Example:
$ message = wordwrap ($ message, 70);
Multiple recipients
If you want an email to multiple recipients, without taking care to take the recipient to see who got the email, it is possible that with a comma separated. The easiest and fastest way is to store the receiver in an array, what is then to a whole string together (implode array method).
Example:
$ empfaenger_array = array ( “test@example.com”, “<exmaple@example.com> first name”);
$ recipients = implode (”,”, $ empfaenger_array);
Now, all recipients with a comma separated in the variable $ receivers, and can be thought of as the first parameter can be used.
In advanced tutorial gives you an insight into the dispatch of BCC and CC recipients, as well as the indication of a sender, and additional options.
