1. dyuchus - 12 Февраля, 2007 - 18:11:11 - перейти к сообщению
собственно весь сабж сформулирован в названии темы
2. valenok - 12 Февраля, 2007 - 19:31:49 - перейти к сообщению
Топаем на сайт php.net/
находим ф-цию mail и читаем комментарии
находим ф-цию mail и читаем комментарии
PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?PHP
- {
- // Reads in a file (eml) a user has inputted
- function eml_read_in()
- {
- // If it is an eml file
- if($file_ext == '.eml')
- {
- // Define vars
- $dir = 'eml/';
- $carry = 'yes';
- // Try and upload the file
- {
- // Now attempt to read the file
- {
- // Create the array to store preliminary headers
- $body = '';
- $ii = -1;
- // For every line, carry out this loop
- foreach($eml_file as $key => $value)
- {
- $pattern = '^<html>';
- {
- // Stop putting data into the $headers array
- $carry = 'no';
- $i++;
- $body .= $value;
- }
- else
- {
- // Separate each one with a colon
- {
- // The row has been split in half at least...
- {
- // Put it into the preliminary headers
- $headers[$eml_file_expl[0]] = $eml_file_expl[1];
- // There might be more semicolons in it...
- for($i=2;$i<=$count;$i++)
- {
- // Add the other values to the header
- $headers[$eml_file_expl[0]] .= ':'.$eml_file_expl[$i];
- }
- }
- }
- }
- }
- // Clear up the headers array
- $eml_values[to] = $headers[To];
- $eml_values[from] = $headers[From];
- $eml_values[subject] = $headers[Subject];
- $eml_values['reply-to'] = $headers['Reply-To'];
- $eml_values['content-type'] = $headers['Content-Type'];
- $eml_values[body] = $body;
- return $eml_values;
- }
- }
- else
- {
- return '<p>File not uploaded - there was an error</p>';
- }
- }
- }
- // Takes information automatically from the $_FILES array...
- $eml_pattern = eml_read_in()
- // Headers definable...through eml_read_in() again, but I'm guessing they'll be the same for each doc...
- if(mail($eml_pattern[to], $eml_pattern[subject], $eml_pattern[content], $headers)) echo 'Mail Sent';
- ?>