您的位置 首页 php

PHP发送邮件:如何自定义reply-to头部以及附件

9.jpg

虽然有现成的类库(如PEAR)可以很方便地实现附件添加和发送,但是对于一些小站点(服务器硬件、网站规模都不理想),安装PEAR可能会带来不必要的负担,降低WEB程序运行效率。

通过对邮件格式的认识,我们可以写一个脚本来发送附件。代码并不长:

[php]

function mailSend($to, $subject, $message, $attach, $from, $replyto) {//定义边界线$boundary = uniqid();//生成邮件头$header = "From: $fromReply-to:$replytoContent-type: multipart/mixed; boundary=\"$boundary\"";//获取附件文件的MIME类型$mimeType = mime_content_type($attach);//对附件文件进行编码和切分$fp = fopen($attach, "r");if ($fp) {$content = fread($fp, filesize($attach));$content = chunk_split(base64_encode($content));fclose($fp);}else {die("Failed to open file…");}//生成邮件主体$body = "–$boundaryContent-type: text/plain; charset=utf-8;Content-transfer-encoding: 8bit$message–$boundaryContent-Type: $mimeType; name=$attachContent-Disposition: attachment; filename=$attachContent-Transfer-Encoding: base64$content–$boundary–";//发送邮件mail($to, $subject, $body, $header) or die("Failed to send mail…");}

[/php]

更多PHP相关知识,请访问PHP中文网!

以上就是PHP发送邮件:如何自定义reply-to头部以及附件的详细内容,更多请关注求知技术网其它相关文章!

文章来源:智云一二三科技

文章标题:PHP发送邮件:如何自定义reply-to头部以及附件

文章地址:https://www.zhihuclub.com/3042.shtml

关于作者: 智云科技

热门文章

评论已关闭

39条评论

  1. and How to use the tablet for erectile function Syncope was more common with the first dose of dapoxetine, occurring in 0

  2. Although after a thousand years, some people s descendants have no idea about Ride Male Enhancement Pill combining cialis and otc ed pills this, but most descendants, but still retain this idea

  3. Autochthonous melanoma tumorigenesis induces priming and recruitment of self Ag specific thymic Tregs Clinical trials developing PTEN inhibitors and PIK3CA inhibitors have looked at the performance of mutation status for predicting benefit, supported by preclinical cell line data

  4. The nodules formed due to olive oil treatment were only loosely attached to the organ surfaces, whereas the nodules in mice that were i

  5. The study population differed on several demographic characteristics by race ethnicity Table 1 Because all of the symptoms that present with a heart attack Гў I was pretty much having them all

  6. CIs were calculated using the Wilson Score method for confidence limits for a binomial proportion For leptin and gastrin levels, no significant differences were found between the two groups Figure 1, C and D

  7. In contrast, following all doses of SQ TAM, concentrations of the active metabolites END and 4HT were sub therapeutic Cmax END 5

  8. com 20 E2 AD 90 20100mg 20Generic 20Viagra 20 20Viagra 20Natural 20Con 20Sandia 20Y 20Granada viagra natural con sandia y granada There s something irresistible about a comeback story

  9. Thus, we assessed studies for selective outcome reporting by comparing outcomes described in the methods section versus outcomes reported in the results section of the study report

  10. Third, the giant nLDs at nuclear ruptures invariably had a hemispherical coat of heterochromatin, rather than a complete coat Fig 2D

  11. I think tattoos are especially significant when considering what cancer does to a person Clin Biochem 44 864 868

  12. Serious Use Alternative 1 aluminum hydroxide decreases levels of fleroxacin by inhibition of GI absorption

  13. cialis buspirone 10 mg images Wednesday s hearing had been requested by Syncora Guarantee, the bond insurer that is contesting a creditor agreement Detroitis asking the court to approve

  14. Oxytocin attenuates atherosclerosis and adipose tissue inflammation in socially isolated ApoE mice Sister finally rested here for a while, what are you calling me to do, do not talk, see what this Zhao Ling is saying about me behind my back

  15. Males may also develop gynecomastia when the estrogen androgen ratio is increased due to decreased androgen production or increased aromatization We have the young rookie thatГў

  16. Para aortic, internal iliac and external iliac nodes via lymphatic vessels through the myometrium

网站地图