©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
(PHP 4, PHP 5, PHP 7)
imap_mail — Send an email message
$to
, string $subject
, string $message
[, string $additional_headers
= NULL
[, string $cc
= NULL
[, string $bcc
= NULL
[, string $rpath
= NULL
]]]] )This function allows sending of emails with correct handling of Cc and Bcc receivers.
The parameters to
, cc
and bcc
are all strings and are all parsed
as » RFC822 address lists.
to
The receiver
subject
The mail subject
message
The mail body, see imap_mail_compose()
additional_headers
As string with additional headers to be set on the mail
cc
bcc
The receivers specified in bcc
will get the
mail, but are excluded from the headers.
rpath
Use this parameter to specify return path upon mail delivery failure. This is useful when using PHP as a mail client for multiple users.
成功时返回 TRUE
, 或者在失败时返回 FALSE
。
[#1] ava3ar at gmail dot com [2011-08-04 13:50:15]
a patch has been submitted to fix this in 5.4
[#2] Mathias Rav [2009-06-23 09:07:05]
As per http://bugs.php.net/bug.php?id=30688 the $rpath argument is ignored, and since the (as of now) 4 year old bug is tagged WONTFIX in the bug tracker, this function is effectively deprecated in favour of mail().
[#3] uphonesimon at gmail dot com [2005-12-22 23:45:26]
make sure you've correctly setup the SMTP parameters in php.ini
and aslo make sure that the SMTP server accepts relay
for some mail servers, you have to open up an imap stream, log in, and then you can send mail through imap_mail
[#4] bandpay at hotmail dot com [2001-01-05 06:01:05]
Extending the above note.
When the socket connection is stablished, it works exactly as if you had openned a telnet connection to the news server. If you don't know what kind of headers you have to send to the news server, then I'll suggest that you better give it a try and play with a telnet connection like this:
telenet news.servername.com 119
eaxmple:
telnet news.euroconnect.dk 119
Trying 195.184.44.30...
Connected to news.euroconnect.net (195.184.44.30).
Escape character is '^]'.
200 news.euroconnect.net (Typhoon v1.2.1)
then you'll receive confirmation from the server that you are connected. Now type "help" and enter, and you'll see what commands are supported.
eaxmle:
help
100 Legal Commands
article [<messageid>|number]
authinfo type value
body [<messageid>|number]
date
group newsgroup
head [<messageid>|number]
help
last
list [active wildmat|active.times|counts wildmat]
list [overview.fmt|newsgroups wildmat]
listgroup newsgroup
mode reader
newgroups yyyymmdd hhmmss [GMT]
newnews newsgroups yyyymmdd hhmmss [GMT]
next
post
stat [<messageid>|number]
xhdr field [range]
xover [range]
xpat field range pattern
quit
If you want to post a message, you can start by entring the "post" command.
example:
post
340 Send Article to be Posted
From here you can start to enter the header information.
The most important headers are:
From:
Subject:
Newsgroup:
after the ":" a "white space" must follow.
If you are posting the multipart message then remember
MIME-Version: 1.0
This one is also one of the important headers when you are posting a multipart message. The boundary must follow the content type in the same line.
Content-Type: multipart/mixed; boundary="------------4A11A9ABCFCA70DD4E0C3605"
Take a look at the article below to find out more about headers and packing of the message.
http://www.phpbuilder.com/columns/kartic20000807.php3