php socket发送电子邮箱来验证邮箱的真实有效性而非格式,phpSocket发送电子邮箱来验证邮箱的真实有效性而非格式-PHP源码...

phpSocket发送电子邮箱来验证邮箱的真实有效性而非格式-PHP源码验证邮箱的真实性而非格式host = $host;

$this->port = $port;

$this->user = base64_encode($user);

$this->pass = base64_encode($pass);

$this->debug = $debug;

$this->socket = socket_create (AF_INET, SOCK_STREAM, SOL_TCP); //具体用法请参考手册

if($this->socket)

{

$this->result_str ="创建SOCKET:".socket_strerror(socket_last_error());

$this->debug_show($this->result_str);

}

else

{

exit("初始化失败,请检查您的网络连接和参数");

}

$this->conn = socket_connect($this->socket,$this->host,$this->port);

if($this->conn)

{

$this->result_str ="创建SOCKET连接:".socket_strerror(socket_last_error());

$this->debug_show($this->result_str);

}

else

{

exit("初始化失败,请检查您的网络连接和参数");

}

$this->result_str ="服务器应答:".socket_read ($this->socket, 1024)."";

$this->debug_show($this->result_str);

}

function debug_show($str)

{

if($this->debug)

{

echo $str."

rn";

}

}

function send($from,$to,$subject,$body)

{

if($from ==""|| $to =="")

{

exit("请输入信箱地址");

}

if($subject =="") $sebject ="无标题";

if($body =="") $body ="无内容";

$this->from = $from;

$this->to = $to;

$this->subject = $subject;

$this->body = $body;

//扬帆修改部分代码

$All ="From:from.">rn";

$All .="To:to.">rn";

$All .="Subject:".$this->subject."rnrn";

$All .= $this->body;

//以下是和服务器会话

$this->in ="EHLO HELOrn";

$this->docommand();

$this->in ="AUTH LOGINrn";

$this->docommand();

$this->in = $this->user."rn";

$this->docommand();

$this->in = $this->pass."rn";

$this->docommand();

// $this->in ="MAIL FROM:".$this->from."rn";

$this->in ="MAIL FROM:from.">rn"; //扬帆修改

$this->docommand();

// $this->in ="RCPT TO:".$this->to."rn";

$this->in ="RCPT TO:to.">rn"; //扬帆修改

$this->docommand();

$this->in ="DATArn";

$this->docommand();

$this->in = $All."rn.rn";

$this->docommand();

$this->in ="QUITrn";

$this->docommand();

//结束,关闭连接

}

function docommand()

{

socket_write ($this->socket, $this->in, strlen ($this->in));

$this->debug_show("客户机命令:".$this->in);

$this->result_str ="服务器应答:".socket_read ($this->socket, 1024)."";

$this->debug_show($this->result_str);

}

}

?>send("yourmail@qq.com","yourmail@qq.com","你好","测试邮件");

?>

/php/33440.htmlwww.phpzy.comtrue/php/33440.htmlTechArticlephpSocket发送电子邮箱来验证邮箱的真实有效性而非格式-PHP源码 验证邮箱的真实性而非格式 host = $host; $this->port = $port; $this->user = base64_encode($user); $this->pass = base64_encode($pass); $this->debug...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值