Implementation of the Send_mail class
Now I'm going to start by describing the sending message Class I wrote. With the above preparatory knowledge, the following is achieved.
member variables of the class
var $lastmessage; Record the last returned response information
var $lastact; The last action, the string form
var $welcome; Use behind helo, welcome user
var $debug; Whether to display debug information
var $smtp; SMTP server
var $port; SMTP port number
var $fp; Socket handle
Among them, $lastmessage and $lastact are used to record the last response information and the commands executed, which can be used by the user when an error occurs. To test the need, I have also defined the $debug variable, and when its value is true, some execution information is displayed during the run, otherwise there is no output. $FP is used to save the open socket handle.
Construction of Class
function Send_mail ($smtp, $welcome = "", $debug =false)
{
if (empty ($SMTP)) Die ("SMTP cannt is null!");
$this-$#@62;smtp= $smtp;
if (empty ($welcome))
{
$this-$#@62;welcome=gethostbyaddr ("localhost");
}
Else
$this-$#@62;welcome= $welcome;
$this-$#@62;debug= $debug;
$this-$#@62;lastmessage= "";
$this-$#@62;lastact= "";
$this-$#@62;port= "25";
}
This constructor mainly completes the determination and setting of some initial values. $welcome used in the HELO directive to tell the server user the name.
The helo instruction requires a machine name, but it is not possible. If the user does not give $welcome, the local machine name is automatically found.
http://www.bkjia.com/PHPjc/531784.html www.bkjia.com true http://www.bkjia.com/PHPjc/531784.html techarticle the implementation of the Send_mail class now begins with the Send message Class I wrote. With the above preparatory knowledge, the following is achieved. The member variable of the class Var $lastmessage; Record last ...