zoukankan      html  css  js  c++  java
  • 第5月第15天 php email

    1.

    <?php  
     require_once "Mail.php";  
       
     $from = "luckyeggs<fuping304@163.com>";  
     $to = "cheking<fuping304@163.com>";  
     //$to = "cheking<394276418@qq.com>";  
     $subject = "hello!";  
     $body = "12312";  
     
      /*********ʹÓÃÒÔÏÂÃû³ÆsslЭÒé·¢ËÍ***********/
     //$host = "ssl://smtp.163.com";  
     //$port = "465";
     
     
     /*********ʹÓÃÒÔÏÂÃû³Æ·ÇsslЭÒé·¢ËÍ***********/
     $host = "smtp.163.com";  
     $port = "25";  
     $username = "fuping304";  
     $password = "";  
       
     $headers = array ('From' => $from,  
       'To' => $to,  
       'Subject' => $subject);  
     $smtp = @Mail::factory('smtp',  
       array ('host' => $host,  
         'port' => $port,  
         'auth' => true,  
         'username' => $username,  
         'password' => $password));  
       
     $mail = @$smtp->send($to, $headers, $body);  
       
     if (@PEAR::isError($mail)) {  
       echo("<p>" . $mail->getMessage() . "</p>");  
      } else {
       echo("<p>Message successfully sent!</p>");
      }  
     ?> 

    2.httprequest down

    $target = "aa.txt";
    $url = "http://www.baidu.com/";
    
    require_once 'installer/HTTPClient.inc';
    $c = new HTTPClient();
    $req = new HTTPRequest();
    $req->setURL($url);
    // if ($from !== null)
    //     $req->downloadRange($from, $to);
    $responses = $c->send($req);
    $resp = $responses[count($responses)-1];
    if ($resp->getStatus() < 200 || $resp->getStatus() >= 300)
        throw new Exception("Error downloading file, server response: ".$resp->getStatus()." ".$resp->getStatusMessage());
    if ($target == null) return $resp->getBody();
    $f = fopen($target,"a");
    fwrite($f,$resp->getBody());
    fclose($f);
    
    
    die("OK");

    https://github.com/passerellesnumeriques/Students-Database/tree/7a7ce9f76670d166413a4a96999d9e3b8b58ead0

  • 相关阅读:
    Django drf 功能组件
    Django drf 视图家族
    Django drf初级
    Django drf序列化器 Serializer
    VUE 全整理
    Django Xadmin的安装方式
    python virtualenv虚拟环境搭建
    版本控制器:操作流程
    版本控制器:GIT线上操作
    《剑指offer》---跳台阶问题
  • 原文地址:https://www.cnblogs.com/javastart/p/6401105.html
Copyright © 2011-2022 走看看