PHP-Fusion
v.7.01
AP-Fusion
v7.02.05
Pimped-Fusion-AP
v0.09.03
May 14 2024 08:38:21
Авторизация
Логин

Пароль



Вы не зарегистрированы?
Нажмите здесь для регистрации.

Забыли пароль?
Запросите новый здесь.
Мини-чат
Вы должны авторизироваться, чтобы добавить сообщение.

lom
06/04/2018 14:03
Мы рады, ждем девятку. Очень хочется пощупать

Alipapa
27/03/2018 22:16
Всем привет, все неисправности устранили, всё у нас работает

mukaton
30/10/2015 02:37
Не получается ничего скачать. Ошибка Not Found
паспорт рф срок изготовления.
Alipapa
06/10/2015 23:00
9-я версия php-fusion на подходе, следите за новостями

Alipapa
10/11/2014 11:24
Заметь, я дважды ответил через 3 минуты после вопроса, могли бы уже решить

Последние статьи
· О стабилизаторах нап...
· СМС и Вебмани
· TinyMCE для пользова...
· PCRE (Perl Compatibl...
· PCRE (Perl Compatibl...
Последние активные темы форума
  Темы Просмотров Ответов Последние сообщения
PHP-Fusion 7 Bogatyr - бесп...
Моды, плагины
7182 1 Vveb--ws
08-10-2018 16:47
Php-Fusion v9. Первые впеча...
Вопросы по работе
4544 3 Vveb--ws
25-07-2018 13:46
Появился хэлп по PHP-Fusion...
Вопросы по работе
6768 7 Vveb--ws
25-07-2018 13:42
prestashop&ap-fusion
Вопросы по работе
17427 61 Alipapa
26-08-2014 10:29
Плагин магазина Ap-Shop
Моды, плагины
14657 70 Alipapa
18-08-2014 18:14
TinyMCE
Вопросы по работе
21172 55 Alipapa
27-07-2013 21:57
HTML-5
Моды, плагины
5456 1 Alipapa
15-06-2013 19:47
Мультиязычность в Pimped-Fu...
Ошибки, баги, глюки
6293 4 Papich
16-04-2013 12:39
Pimped-Fusion. Первые впеча...
Ошибки, баги, глюки
21813 127 Alipapa
18-12-2012 10:59
Ищу мод для расстановки код...
Моды, плагины
15060 55 Alipapa
17-09-2012 14:00
Как присоединить файл к лич...
Моды, плагины
8283 3 lom
27-05-2012 18:12
Что мне не нравится в после...
Вопросы по работе
6876 4 Alipapa
27-05-2012 18:08
Проблемы с добавлением кате...
Вопросы по работе
7777 5 Alipapa
27-05-2012 18:06

mail

(PHP 3, PHP 4 , PHP 5)

mail -- Send mail

Описание

bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )

Sends an email.

Список параметров

to

Receiver, or receivers of the mail.

The formatting of this string must comply with RFC 2822. Some examples are:

user@example.com
user@example.com, anotheruser@example.com
User <user@example.com>
User <user@example.com>, Another User <anotheruser@example.com>

subject

Subject of the email to be sent.

Предостережение

This must not contain any newline characters, or the mail may not be sent properly.

message

Message to be sent.

Each line should be separated with a LF (\n). Lines should not be larger than 70 characters.

Предостережение

(Windows only) When PHP is talking to a SMTP server directly, if a full stop is found on the start of a line, it is removed. To counter-act this, replace these occurrences with a double dot.

<?php
$text
= str_replace ( "\n." , "\n.." , $text );
?>

additional_headers (optional)

String to be inserted at the end of the email header.

This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF (\r\n).

Замечание: If messages are not received, try using a LF (\n) only. Some poor quality Unix mail transfer agents replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with RFC 2822.

additional_parameters (optional)

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.

The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users.

Возвращаемые значения

Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.

It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination.

Список изменений

ВерсияОписание
4.3.0 (Windows only)All custom headers (like From, Cc, Bcc and Date) are supported, and are not case-sensitive. (As custom headers are not interpreted by the MTA in the first place, but are parsed by PHP, PHP < 4.3 only supported the Cc header element and was case-sensitive).
4.2.3The additional_parameters parameter is disabled in safe_mode and the mail() function will expose a warning message and return FALSE when used.
4.0.5The additional_parameters parameter was added.

Примеры

Пример 1. Sending mail.

Using mail() to send a simple email:

<?php
// The message
$message = "Line 1\nLine 2\nLine 3" ;

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap ( $message , 70 );

// Send
mail ( 'caffinated@example.com' , 'My Subject' , $message );
?>

Пример 2. Sending mail with extra headers.

The addition of basic headers, telling the MUA the From and Reply-To addresses:

<?php
$to      
= 'nobody@example.com' ;
$subject = 'the subject' ;
$message = 'hello' ;
$headers = 'From: webmaster@' . $_SERVER [ 'SERVER_NAME' ] . "\r\n" .
    
'Reply-To: webmaster@' . $_SERVER [ 'SERVER_NAME' ] . "\r\n" .
    
'X-Mailer: PHP/' . phpversion ();

mail ( $to , $subject , $message , $headers );
?>

Пример 3. Sending mail with an additional command line parameter.

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path.

<?php
mail
( 'nobody@example.com' , 'the subject' , 'the message' , null ,
   
'-fwebmaster@' . $_SERVER [ 'SERVER_NAME' ]);
?>

Пример 4. Sending HTML email

It is also possible to send HTML email with mail().

<?php
// multiple recipients
$to   = 'aidan@example.com' . ', ' ; // note the comma
$to .= 'wez@example.com' ;

// subject
$subject = 'Birthday Reminders for August' ;

// message
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</body>
</html>
'
;

// To send HTML mail, the Content-type header must be set
$headers   = 'MIME-Version: 1.0' . "\r\n" ;
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n" ;

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n" ;
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n" ;
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n" ;
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n" ;

// Mail it
mail ( $to , $subject , $message , $headers );
?>

Замечание: If intending to send HTML or otherwise Complex mails, it is recommended to use the PEAR package PEAR::Mail.

Примечания

Замечание: The Windows implementation of mail() differs in many ways from the Unix implementation. First, it doesn't use a local binary for composing messages but only operates on direct sockets which means a MTA is needed listening on a network socket (which can either on the localhost or a remote machine).

Second, the custom headers like From:, Cc:, Bcc: and Date: are not interpreted by the MTA in the first place, but are parsed by PHP.

As such, the to parameter should not be an address in the form of "Something <someone@example.com>". The mail command may not parse this properly while talking with the MTA.

Замечание: Email with attachments and special types of content (e.g. HTML) can be sent using this function. This is accomplished via MIME-encoding - for more information, see this Zend article or the PEAR Mime Classes.

Замечание: It is worth noting that the mail() function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient.

For the sending of large amounts of email, see the PEAR::Mail, and PEAR::Mail_Queue packages.

Замечание: The following RFCs may be useful: RFC 1896, RFC 2045, RFC 2046, RFC 2047, RFC 2048, RFC 2049, and RFC 2822.

Смотрите также

imap_mail()
PEAR::Mail
PEAR::Mail_Mime

Все функции PHP:
Навигация
· Новости
· Статьи
· Скачать
· Форум
· Ссылки
· Категории новостей
· Обратная связь
· Галерея
· Поиск
· CMS AP-Fusion. Отличия от PHP-Fusion
· Javascript справочник
· Техника
Сейчас на сайте
· Гостей: 4

· Пользователей: 0

· Всего пользователей: 453
· Новый пользователь: ZDA
Информеры
Загрузка файлов  +  -
9,980,256 уникальных посетителей Iceberg by Harly