Home >Backend Development >PHP Tutorial >Automatically send emails with PHP_PHP tutorial

Automatically send emails with PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:17:161336browse

Automatically send emails using this classhttp://bbs.php100.com/read-htm-tid-121431.html

Because the php version he used is older, he used the functions ereg_replace() and ereg()


Solution

1ereg_replace() function, replace it with the strtr() function

The syntax differences are as follows:

Detailshttp://www.php.net/manual/zh/function.ereg-replace.php

Detailshttp://www.w3school.com.cn/php/func_string_strtr.asp

2ereg() function, replace it with the preg_match() function

Linkhttp://blog.163.com/yanli_xu/blog/static/1363672912011420101820393/

preg_match() FunctionSyntaxhttp://www.php.net/manual/zh/function .preg-match.php

After modification, the complete code is as follows

[Mail class] sm.class.php

Automatically send emails with PHP_PHP tutorial smtp( = "", = 25, = ,, ->debug = ->smtp_port = ->relay_host = ->time_out = 30; ->auth = ; ->user = ->pass = ->host_name = "localhost"; ->log_file = "" ->sock = sendmail(, , = "", = "", , = "", = "", = "" = ->get_address(->strip_comment( = (, "(^|(rn))(.)", "1.3" .= "MIME-Version:1.0rn" (=="HTML" .= "Content-Type:text/htmlrn" .= "To: ".."rn" ( != "" .= "Cc: ".."rn" .= "From: <"..">rn" .= "Subject: ".."rn" .= .= "Date: ".("r")."rn" .= "X-Mailer:By Redhat (PHP/".().")rn" (, ) = (" ", .= "Message-ID: <".("YmdHis", ).".".(*1000000)."."..">rn" = (",", ->strip_comment( ( != "" = (, (",", ->strip_comment( ( != "" = (, (",", ->strip_comment( = ( = ->get_address( (!->smtp_sockopen( ->log_write("Error: Cannot send email to ".."n" = (->smtp_send(->host_name, , , ,
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn