ru en uk

  sing in

(044) 362 48 16   (098) 294 41 60


   Services
   Portfolio
   Prices
   Articles
   Services
   Printing
   Multimedia
   Hosting
   Contacts

Home   |   WEB development   |   Articles   |   Programming in PHP
If you need to send a message to the administrator, the user, make a list,
send a report by e-mail, the easiest way to do this using the built -
function mail (). To make it work must be established:

  1. On Unix platformIU - installed and configured sendmail. If the path
    not in the environment, then you need to specify php.ini sendmail_path = / path / to / sendmail
    -t-i
    in the section [mail function].
  2. On the Windows platform - have a SMTP server. Its parameters must be specified in
    php.ini section [mail function]:

    SMTP = 192.168.1.1

    sendmail_from = admin@example.com

The function is called as
<font color="#0000CC"> mail </ font> <font color="#006600"> (</ font> <font color = "# CC0000 "> whom </ font>, <font color="#CC0000"> Theme </ font>, <font color="#CC0000"> body </ font>, [<font color="#CC0000"> additional
headers </ font>, [<font color="#CC0000"> parameters </ font>]] <font color = "# 006600 ">)</ font>

All you need to do - it is right to establish all the string parameters.



  1. To (copy and Bcc specified additional headers):

    • nobody@example.com
    • John Smith<nobody@example.com>
    • nobody@example.com, pupkin@example.com
    • John Smith <nobody@example.com>, Ivan Pupkin <pupkin@example.com>
    • Theme - a text without newline characters
    • The body - any text, including HTML or MIME
    • Headers - here you can use these headers: From: Cc: Bcc: MIME-Version:
      Content-type: Reply-To: X-Mailer: X-Priority: Date: Content-Transfer-Encoding:

      • From - From: "pupkin@example.com" or "Ivan Pupkin <pupkin@example.com>"
      • Cc - Cc: as well as "who"
      • Bcc - Bcc: as well as "Who" works only on
        Unix
        Reply-To - if you need to substitute the recipient's response, other than the sender
      • X-Priority - the importance of the message (default 3)

      Titles are separated by <font color="#0000CC"> \ r \ n </ font> (on Unix, you can
      only the <font color = & quot; # 0000CC "> \ n </ font>)


If a letter is sent in HTML format, you must set the following
2 lines in the headlines: <br>
<blockquote> MIME-Version: 1.0 \ r \ n; <br>
Content-Type: text / html; charset = & quot; windows-1251 "</ blockquote>

I want to send a letter to attachmentom (s) (such as HTML with images)


You need to use MIME (RFC1896,45.html "> RFC2045,
RFC2046, RFC2047,
RFC2048, RFC2049).
To do thisinitially take the file in a variable and encode it in a safe
base64 encoding using base64_encode (). In the title, you should specify:


MIME-Version: 1.0 \ r \ n <br>
Content-Type: multipart / mixed; boundary = "$ delimiter" Where $ delimiter - any line, can be random. multipart / mixed, you can replace
for multipart / alternative.
$ delimiter ="----=_ Razdelitel_Blokov_ =----"

And in the body of the message to divide the different types of data boundary ($ delimiter) and indicate their Content-Type:
<? php
$ body = "This is a multi-part message in MIME format."; <br>
$ body .= "\ r \ n \ r \ n". $ delimiter; <br>
$ body .= "Content-Type: text / plain; charset = \" windows-1251 \ "\ r \ n \ r \ n"; <br>
$ body .= "Content-Transfer-Encoding: quoted-printable "; <br>
$ body .= "Hello, Ivan! I send you as promised to the picture and summary"; <br>
$ body .= "\ r \ n \ r \ n". $ delimiter; <br>
$ body .= "Content-Type: image / jpeg; name = \" meeting.jpg \ ""; <br>
$ body .= &quot; Content-Transfer-Encoding: base64 "; <br>
$ body .= "Content-Disposition: attachment; filename = \" meeting.jpg \ "\ r \ n \ r \ n"; <br>
$ body .= base64_encode ($ file1); <br>
$ body .= "\ r \ n \ r \ n". $ delimiter; <br>
$ body .= "Content-Type:application / msword; name = \ "referat.doc \" ";
<br>
$ body .= "Content-Transfer-Encoding: base64"; <br>
$ body .= "Content-Disposition: attachment; filename = \" referat.doc \ "\ r \ n \ r \ n"; <br>
$ body .= base64_encode ($ file2); <br> <br /> $ body .= "\ r \ n \ r \ n". $ delimiter;
>


 
What is a session and what they need?
26.04.2007
Lock files
29.05.2007
How to send e-mail
29.05.2007