Send an email using the socket four _php tutorial

Source: Internet
Author: User
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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.