PHP mail Function With Attachments
ÔÌûµØÖ·£ºhttp://www.zedwood.com/article/126/php-mail-function-with-attachments
This code sends an html formatted email with attachments. This email sending script actually sends both a plaintext and an html body of the email, allowing the email client to choose which to display. The plaintext email is generated by stripping html tags from the html formatted body, and replacing
with newline characters.
One of the nice things about this script is that the attachments are stored in an array. If you want to add another attachment, all you have to do is copy and past an existing line in the attachment array, and change the filename.
For each attachment, it automatically looks up the corresponding mimetype.
$file1='test.pdf';
$file2='test2.tar.gz';
$head = array(
'to' =>array('email@email.net'=>'Admin',
'email2@email.net'=>'Admin2'),
'from' =>array('cron@55.66.77.88' =>'CronAgent'),
'cc' =>array('email3@email.net'=>'Admin'),
'bcc' =>array('email4@email.net'=>'Admin'),
);
$subject = date("Ymd")." Weekly Report";
$body ='';
$body.="<div style='font-family:Arial;font-size:10pt;'>";
$body.= "<br>"."Admin,";
$body.= "<br>"."";
$body.= "<br>"."Attached are the files:";
$body.= "<br>"."* ".$file1;
$body.= "<br>"."* ".$file2;
$body.=&nbs
Ïà¹ØÎĵµ£º
×î½üÔÚѧϰphp£¬Ò³ÃæÒѾ×öºÃÁË£¬ÏÖÔÚ¾ÍÊǺÍÐéÄâ»úÀïC´úÂëµÄͨÐÅ£¬socket±à³Ì»¹¿ÉÒÔ£¬¾ÍÊÇÄÃÊý¾ÝµÄ´¦Àí£¬ÄÑ£¬¡£
ÀàµÄ±à³ÌÎÒ²»»á£¬Ã»ÓÐѧ¹ýC++¡£±¾À´´òËãÓýṹÌåµÄ£¬¿ÉÊÇPHPÀïÃæ¾ÓȻûÓнṹÌ壬Ôõô°ìÄØ£¿¼ÌÐøÅ¬Á¦°É
......
PHP»º´æ´úÂë
ºÃµÄÒ³Ãæ»º´æ´úÂ룬¿ÉÒÔ¼õÇáCPUºÍMYSQL¸ºµ£¡£Ê¹ÓÃǰ£¬ÏÈÔÚ¸ùĿ¼´´½¨“cache”Îļþ¼Ð£¬È»ºóÔËÐÐ1.php£¬µÚÒ»´ÎÔËÐк͵ڶþ´ÎÔËÐÐËٶȲîÒìºÜ´ó¡£»¶ÓÊìϤPHPµÄÅóÓÑʹÓúÍÌáÒâ¼û¡£
ʹÓ÷½·¨:(Çë±£´æÎªtemp.php)
<?php
include('arrcache.php');
$cache = new ArrCache('cache',5,'txt');
......
$_SERVER´æ´¢µ±Ç°·þÎñÆ÷ÐÅÏ¢£¬ÆäÖÐÓм¸¸öÖµÈç$_SERVER["QUERY_STRING"]£¬$_SERVER["REQUEST_URI"]£¬$_SERVER["SCRIPT_NAME"]ºÍ$_SERVER["PHP_SELF"]³£³£ÈÝÒ×»ìÏý£¬ÒÔÏÂͨ¹ýʵÀýÏê½â$_SERVERº¯ÊýÖÐQUERY_STRING£¬REQUEST_URI£¬SCRIPT_NAMEºÍPHP_SELF±äÁ¿Çø±ð£¬ÕÆÎÕÕâËÄÕßÖ®¼äµÄ¹ØÏµ£¬±ãÓÚÔÚʵ¼ÊÓ¦ÓÃÖÐÕýÈ·»ñÈ¡ËùÐèÒªµÄÖµ
1£ ......
ÔÚÍøÕ¾ÐèÒª½¨Á¢¹²Ïí½Ó¿ÚµÄʱºò£¬¿ÉÒÔʹÓÃsoap¡£ ÏÂÃæ½éÉÜÏÂÔÚPHPÖÐÈçºÎʹÓÃSOAPµÄÍêÕû¹ý³Ì¡£
1¡¢È·ÈÏPHP»·¾³ÊÇ·ñÖ§³Ösoap,¼ì²éphpÅäÖÃÎļþ£¬°Ñextension=php_soap.dllǰµÄ·ÖºÅ(;)È¥µô(windows);ÈôÊÇ×Ô¼º±àÒëÔò±àÒëʱ±ØÐë¼ÓÉÏ --enable-soapÑ¡Ïî¡£
2¡¢½¨Á¢soap·þÎñ¶Ë¡£ ÏÂÃæÍ¨¹ýʵÀýÀ´ËµÃ÷ÈçºÎ½¨Á¢·þÎñ¶Ë¡£
<?php
cla ......
¿µÊ¢µÄ authcode º¯Êý¿ÉÒÔ˵¶ÔÖйúµÄPHP½ç×÷³öÁËÖØ´ó¹±Ïס£°üÀ¨¿µÊ¢×Ô¼ºµÄ²úÆ·£¬ÒÔ¼°´ó²¿·ÖÖйúʹÓÃPHPµÄ¹«Ë¾¶¼ÓÃÕâ¸öº¯Êý½øÐмÓÃÜ£¬authcode ÊÇʹÓÃÒì»òÔËËã½øÐмÓÃܺͽâÃÜ¡£
ÔÀíÈçÏ£¬¼ÙÈ磺
¼ÓÃÜ
Ã÷ÎÄ£º1010 1001
Ãܳףº1110 0011
ÃÜÎÄ£º0100 1010
µÃ³öÃÜÎÄ0100 1010£¬½âÃÜÖ®ÐèºÍÃܳ×Òì»òϾͿÉÒÔÁË
½âÃÜ ......