> php教程 > php手册 > 본문

PHP自动发邮件

WBOY
풀어 주다: 2016-06-13 10:17:45
원래의
1083명이 탐색했습니다.

自动发邮件 使用了这个类http://bbs.php100.com/read-htm-tid-121431.html

因他用的php版本较老,用到了函数ereg_replace() 和 ereg()


 

解决方法

1ereg_replace() 函数,替换为 strtr() 函数

语法不同点如下

 

详情http://www.php.net/manual/zh/function.ereg-replace.php

 

详情http://www.w3school.com.cn/php/func_string_strtr.asp

 

2ereg()  函数,替换为 preg_match() 函数

 

 链接http://blog.163.com/yanli_xu/blog/static/1363672912011420101820393/

preg_match() 函数语法http://www.php.net/manual/zh/function.preg-match.php

 

修改完毕后,完整代码如下

【邮件类】sm.class.php

smtp( = "", = 25, = ,, ->debug = ->smtp_port = ->relay_host = ->time_out = 30; ->auth = ; ->user = ->pass = ->host_name = "localhost"; ->log_file = "" ->sock = sendmail(, , = "", = "", , = "", = "", = "" = ->get_address(->strip_comment( = (, "(^|(\r\n))(\.)", "\1.\3" .= "MIME-Version:1.0\r\n" (=="HTML" .= "Content-Type:text/html\r\n" .= "To: ".."\r\n" ( != "" .= "Cc: ".."\r\n" .= "From: .">\r\n" .= "Subject: ".."\r\n" .= .= "Date: ".("r")."\r\n" .= "X-Mailer:By Redhat (PHP/".().")\r\n" (, ) = (" ", .= "Message-ID: ("YmdHis", ).".".(*1000000)."."..">\r\n" =
관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!