php mail函数发送电子邮件(可带附件)

 更新时间:2016年11月25日 17:02  点击:1737
这是一款利用php 自带的函数mail进行邮件发送,同时还支持附件的发送哦。

(可带附件<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en"

 代码如下 复制代码

"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>php mail函数发送电子邮件(可带附件)</title>
</head>

<body>
<?php
 // you might need to change this line, if you do not use
 // the default ports, 80 for normal traffic and 443 for ssl
 if($_server['server_port']!=443)
   echo '<p><font color = red>
            warning: you have not connected to this page using ssl. 
            your message could be read by others.</font></p>';
?>

<form method = post action = "send_private_mail.php"><br>
your email address:<br>
<input type = text name = from size = 38><br>
subject:<br>
<input type = text name = title size = 38><br>
your message:<br>
<textarea name = body cols = 30 rows = 10>
</textarea><br>
<input type = submit value = "send!">
</form>
</body>
</html>

send_private_mail.php文件

 代码如下 复制代码

<?php
  //create short variable names
  $from = $_post['from'];
  $title = $_post['title'];
  $body = $_post['body'];

  $to_email = 'luke@localhost';

  // tell gpg where to find the key ring
  // on this system, user nobody's home directory is /tmp/
  putenv('gnupghome=/tmp/.gnupg');
 
  //create a unique file name
  $infile = tempnam('', 'pgp'); 
  $outfile = $infile.'.asc';

  //write the user's text to the file
  $fp = fopen($infile, 'w');
  fwrite($fp, $body);
  fclose($fp);

  //set up our command
  $command =  "/usr/local/bin/gpg -a \
               --recipient 'luke welling <luke@tangledweb.com.au>' \
               --encrypt -o $outfile $infile";

  // execute our gpg command
  system($command, $result);

  //delete the unencrypted temp file
  unlink($infile);

  if($result==0)
  {
    $fp = fopen($outfile, 'r');   
    if(!$fp||filesize ($outfile)==0)
    {
      $result = -1;
    }
    else
    {
      //read the encrypted file
      $contents = fread ($fp, filesize ($outfile));
      //delete the encrypted temp file
      unlink($outfile);     

      mail($to_email, $title, $contents, "from: $from ");
      echo '<h1>message sent</h1>
            <p>your message was encrypted and sent.
            <p>thank you.';
    }
  }

  if($result!=0)
  {
    echo '<h1>error:</h1>
          <p>your message could not be encrypted, so has not been sent.
          <p>sorry.';
  }
 

/*
 
  */
?>)

这款php 邮件发送类代码是一款用户注册这后忘了密码然后自动找回密码时,会自动发送一封邮件到用户邮箱,并有用户名与密码。
 代码如下 复制代码

class smtp
{
/* public variables */
var $smtp_port;
var $time_out;
var $host_name;
var $log_file;
var $relay_host;
var $debug;
var $auth;
var $user;
var $pass;

/* private variables */
var $sock;

/* constractor */
function smtp($relay_host = "", $smtp_port = 25,$auth = false,$user,$pass)
{
$this->debug = false;
$this->smtp_port = $smtp_port;
$this->relay_host = $relay_host;
$this->time_out = 30; //is used in fsockopen()
#
$this->auth = $auth;//auth
$this->user = $user;
$this->pass = $pass;
#
$this->host_name = "localhost"; //is used in helo command
$this->log_file ="";

$this->sock = false;
}

/* main function */
function sendmail($to, $from, $subject = "", $body = "", $mailtype, $cc = "", $bcc = "", $additional_headers = "")
{
$mail_from = $this->get_address($this->strip_comment($from));
$body = ereg_replace("(^|( ))(\.)", "\1.\3", $body);
$header .= "mime-version:1.0 ";
if($mailtype=="html"){
$header .= "content-type:text/html ";
}
$header .= "to: ".$to." ";
if ($cc != "") {
$header .= "cc: ".$cc." ";
}
$header .= "from: $from<".$from."> ";
$header .= "subject: ".$subject." ";
$header .= $additional_headers;
$header .= "date: ".date("r")." ";
$header .= "x-mailer:by redhat (php/".phpversion().") ";
list($msec, $sec) = explode(" ", microtime());
$header .= "message-id: <".date("ymdhis", $sec).".".($msec*1000000).".".$mail_from."> ";
$to = explode(",", $this->strip_comment($to));

if ($cc != "") {
$to = array_merge($to, explode(",", $this->strip_comment($cc)));
}

if ($bcc != "") {
$to = array_merge($to, explode(",", $this->strip_comment($bcc)));
}

$sent = true;
foreach ($to as $rcpt_to) {
$rcpt_to = $this->get_address($rcpt_to);
if (!$this->smtp_sockopen($rcpt_to)) {
$this->log_write("error: cannot send email to ".$rcpt_to." ");
$sent = false;
continue;
}
if ($this->smtp_send($this->host_name, $mail_from, $rcpt_to, $header, $body)) {
$this->log_write("e-mail has been sent to <".$rcpt_to."> ");
} else {
$this->log_write("error: cannot send email to <".$rcpt_to."> ");
$sent = false;
}
fclose($this->sock);
$this->log_write("disconnected from remote host ");
}
echo "<br>";
//echo $header;
return $sent;
}

/* private functions */

function smtp_send($helo, $from, $to, $header, $body = "")
{
if (!$this->smtp_putcmd("helo", $helo)) {
return $this->smtp_error("sending helo command");
}
#auth
if($this->auth){
if (!$this->smtp_putcmd("auth login", base64_encode($this->user))) {
return $this->smtp_error("sending helo command");
}

if (!$this->smtp_putcmd("", base64_encode($this->pass))) {
return $this->smtp_error("sending helo command");
}
}
#
if (!$this->smtp_putcmd("mail", "from:<".$from.">")) {
return $this->smtp_error("sending mail from command");
}

if (!$this->smtp_putcmd("rcpt", "to:<".$to.">")) {
return $this->smtp_error("sending rcpt to command");
}

if (!$this->smtp_putcmd("data")) {
return $this->smtp_error("sending data command");
}

if (!$this->smtp_message($header, $body)) {
return $this->smtp_error("sending message");
}

if (!$this->smtp_eom()) {
return $this->smtp_error("sending <cr><lf>.<cr><lf> [eom]");
}

if (!$this->smtp_putcmd("quit")) {
return $this->smtp_error("sending quit command");
}

return true;
}

function smtp_sockopen($address)
{
if ($this->relay_host == "") {
return $this->smtp_sockopen_mx($address);
} else {
return $this->smtp_sockopen_relay();
}
}

function smtp_sockopen_relay()
{
$this->log_write("trying to ".$this->relay_host.":".$this->smtp_port." ");
$this->sock = @fsockopen($this->relay_host, $this->smtp_port, $errno, $errstr, $this->time_out);
if (!($this->sock && $this->smtp_ok())) {
$this->log_write("error: cannot connenct to relay host ".$this->relay_host." ");
$this->log_write("error: ".$errstr." (".$errno.") ");
return false;
}
$this->log_write("connected to relay host ".$this->relay_host." ");
return true;;
}

function smtp_sockopen_mx($address)
{
$domain = ereg_replace("^.+@([^@]+)$", "\1", $address);
if (!@getmxrr($domain, $mxhosts)) {
$this->log_write("error: cannot resolve mx "".$domain."" ");
return false;
}
foreach ($mxhosts as $host) {
$this->log_write("trying to ".$host.":".$this->smtp_port." ");
$this->sock = @fsockopen($host, $this->smtp_port, $errno, $errstr, $this->time_out);
if (!($this->sock && $this->smtp_ok())) {
$this->log_write("warning: cannot connect to mx host ".$host." ");
$this->log_write("error: ".$errstr." (".$errno.") ");
continue;
}
$this->log_write("connected to mx host ".$host." ");
return true;
}
$this->log_write("error: cannot connect to any mx hosts (".implode(", ", $mxhosts).") ");
return false;
}

function smtp_message($header, $body)
{
fputs($this->sock, $header." ".$body);
$this->smtp_debug("> ".str_replace(" ", " "."> ", $header." > ".$body." > "));

return true;
}

function smtp_eom()
{
fputs($this->sock, " . ");
$this->smtp_debug(". [eom] ");

return $this->smtp_ok();
}

function smtp_ok()
{
$response = str_replace(" ", "", fgets($this->sock, 512));
$this->smtp_debug($response." ");

if (!ereg("^[23]", $response)) {
fputs($this->sock, "quit ");
fgets($this->sock, 512);
$this->log_write("error: remote host returned "".$response."" ");
return false;
}
return true;
}

function smtp_putcmd($cmd, $arg = "")
{
if ($arg != "") {
if($cmd=="") $cmd = $arg;
else $cmd = $cmd." ".$arg;
}

fputs($this->sock, $cmd." ");
$this->smtp_debug("> ".$cmd." ");

return $this->smtp_ok();
}

function smtp_error($string)
{
$this->log_write("error: error occurred while ".$string.". ");
return false;
}

function log_write($message)
{
$this->smtp_debug($message);

if ($this->log_file == "") {
return true;
}

$message = date("m d h:i:s ").get_current_user()."[".getmypid()."]: ".$message;
if (!@file_exists($this->log_file) || !($fp = @fopen($this->log_file, "a"))) {
$this->smtp_debug("warning: cannot open log file "".$this->log_file."" ");
return false;
}
flock($fp, lock_ex);
fputs($fp, $message);
fclose($fp);

return true;
}

function strip_comment($address)
{
$comment = "\([^()]*\)";
while (ereg($comment, $address)) {
$address = ereg_replace($comment, "", $address);
}

return $address;
}

function get_address($address)
{
$address = ereg_replace("([ ])+", "", $address);
$address = ereg_replace("^.*<(.+)>.*$", "\1", $address);

return $address;
}

function smtp_debug($message)
{
if ($this->debug) {
echo $message."<br>";
}
}

function get_attach_type($image_tag) { //

$filedata = array();

$img_file_con=fopen($image_tag,"r");
unset($image_data);
while ($tem_buffer=addslashes(fread($img_file_con,filesize($image_tag))))
$image_data.=$tem_buffer;
fclose($img_file_con);

$filedata['context'] = $image_data;
$filedata['filename']= basename($image_tag);
$extension=substr($image_tag,strrpos($image_tag,"."),strlen($image_tag)-strrpos($image_tag,"."));
switch($extension){
case ".gif":
$filedata['type'] = "image/gif";
break;
case ".gz":
$filedata['type'] = "application/x-gzip";
break;
case ".htm":
$filedata['type'] = "text/html";
break;
case ".html":
$filedata['type'] = "text/html";
break;
case ".jpg":
$filedata['type'] = "image/jpeg";
break;
case ".tar":
$filedata['type'] = "application/x-tar";
break;
case ".txt":
$filedata['type'] = "text/plain";
break;
case ".zip":
$filedata['type'] = "application/zip";
break;
default:
$filedata['type'] = "application/octet-stream";
break;
}


return $filedata;
}

}

//使用方法

 代码如下 复制代码
$smtps教程erver = "smtp.163.com";//smtp服务器
$smtpserverport =25;//smtp服务器端口
$smtpusermail = "请输入自己的网易邮箱账户";//smtp服务器的用户邮箱
$smtpemailto = $rs['email'];//发送给谁
$smtpuser = "请输入自己的网易邮箱账户名";//smtp服务器的用户帐号
$smtppass = "请输入自己的网易邮箱密码";//smtp服务器的用户密码
$mailsubject = "设置新密码";//邮件主题
$mailbody = "{$rs['username']}您好!这里是powered by 您的临时新密码是: $emailpwd" .
   " 请点击下面的网址,进入设置新密码页面,完成新密码的设置。" .
   "<a href='http://www.111cn.net'>设置新密码</a>";//邮件内容
$mailtype = "html";//邮件格式(html/txt),txt为文本邮件
##########################################
$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);//这里面的一个true是表示使用身份验证,否则不使用身份验证.
$smtp->debug = false;//是否显示发送的调试信息
$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
$prompt_msg->p('系统已经邮件发出,请注意查收!','index.php','返回首页');

?>

本文章不光是是一款利用php发送邮件类代码与是一款实用的php邮件发送代码,如果你是初学者,可以拿当作学习同时也可以使用,如果是你开发者,这款邮件类完全可以使用哦。
 代码如下 复制代码

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>使用php发送电子邮件</title>
<style type="text/css教程">
<!--
.style1 {font-size: 12px}
.style2 {
 font-size: 24px;
 font-weight: bold;
}
-->
</style>
</head>

<body>
<p align="center" class="style2">使用php发电子邮件</p>
<form name="form1" method="post" action="send_mail.php">
<table width="444" height="347" border="0" align="center">
    <tr>
        <td width="71" height="23" bgcolor="#d6b1e9">
        <div align="right" class="style1">
            <div align="left">&nbsp;收件人</div>
        </div>
        </td>
        <td width="363">
            <label>&nbsp;<input type="text" name="sendto"></label>
        </td>
    </tr>
    <tr>
        <td height="27" bgcolor="#d6b1e9">
        <div align="right" class="style1">
            <div align="left">&nbsp;邮件标题</div>
        </div></td>
        <td>
            <label>&nbsp;<input type="text" name="subject"></label>
        </td>
    </tr>
    <tr>
        <td height="23" colspan="2" bgcolor="#d6b1e9">
        <div align="right" class="style1">
            <div align="left">&nbsp;邮件正文</div>
        </div>
        </td>
    </tr>
    <tr>
        <td colspan="2" bgcolor="#d6b1e9">
        <div align="right">www.111cn.net
            <label>
            <div align="left">
                <textarea name="emailcontent" cols="60" rows="18"></textarea>
            </div>
            </label>
        </div>
          <div align="right"></div>
        <div align="right"></div>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <label><input type="submit" name="submit" value="提交"></label>
        </td>
    </tr>
</table>
</form>

</body>
</html>

 

邮件群发其实非常的简单只要利用遍历发布就可以了,下面本例子利用了phpmailer函数来登录163邮箱给QQ邮箱发邮件,希望本文章对各位同学有帮助。

*@author ray
*@since 2009-08-07

smtp邮件帐号一定要多,不然会被qq服务器当作垃圾邮件。
2.得适当的休眠

smtp.dat文件格式为
smtp.163.com|sss@163.com|密码
smtp.sina.com|www@sina.com|密码 www.111cn.net
程序随机抽取一个连接,发送邮件,如果发送不成功,将该邮件地址存入sleepmail.dat休眠30分后在发送(这个是为了连接smtp服务器多次后发送不成功而做的修改)。
*/

 代码如下 复制代码
define('__debug__', false);
define('__ps教程w_file__', dirname(__file__) . '/smtp.dat');
define('sleeping_email', dirname(__file__) . "/sleepmail.dat");//休眠的email
define('sleeping_time', 1800);//休眠多长时间,以秒为单位
define('file_append', 1);
if (!function_exists('file_put_contents')) {
    function file_put_contents($n, $d, $flag = false) {
        $mode = ($flag == file_append || strtoupper($flag) == 'file_append') ? 'a' : 'w';
        $f = @fopen($n, $mode);
        if ($f === false) {
            return 0;
        } else {
            if (is_array($d)) $d = implode($d);
            $byteswritten = fwrite($f, $d);
            fclose($f);
            return $byteswritten;
        }
    }
}
$errorno = 0;
$errormsg = '';
$currtime = time();
$unusemails = array();
//收件人和邮件标题和邮件内容
$to = isset($argv[1]) ? $argv[1] : "" ;
$subject = isset($argv[2]) ? $argv[2] : "";
$mailfile = isset($argv[3]) ? $argv[3] : "" ;
if (__debug__) {
    echo "
file:$mailfile to:$to subject:$subject ";
}
if (empty($mailfile) || empty($to) || empty($subject)) {
    $errorno = 1;
    $errormsg = "参数不全";
}
//加载不可用的email列表
if (!$errorno) {
    if (file_exists(sleeping_email)) {
        $sleepmails = file(sleeping_email);
        if (!empty($sleepmails)) {
       
            foreach($sleepmails as $sleepmail) {
                //解析
                if (false !== strpos($sleepmail, '|')) {
                    $tmp = explode('|', $sleepmail);
                    if (isset($tmp[0]) && isset($tmp[1])) {
                        $mail = trim($tmp[0]);
                        $time = trim($tmp[1]);
                       
                        //是否可用
                        if ( ($currtime - $time )< sleeping_time) {
                            $unusemails[] = $mail;
                        }
                    }
                }
            }
        }
    }
}
if (!$errorno) {
    //随机加载smtp服务器和smtp用户名和密码
    $info = file(__psw_file__);
    $len = count($info);
   
    do {
        $rnd = mt_rand(0, $len - 1);
        $line = isset($info[$rnd]) ? $info[$rnd] : "";
       
        if (false !== strpos($line, '|')) {
       
            $tmp = explode('|', $line);
            if (isset($tmp[0]) && isset($tmp[1]) && isset($tmp[2])) {
               
                $smtpserver = trim($tmp[0]);
                $frommail = trim($tmp[1]);
                $psw = trim($tmp[2]);
                $smtpusername = substr($frommail, 0, strrpos($frommail, '@'));
            }
        }
    }while (in_array($frommail, $unusemails));//如果在不可用的列表中,在次加载
   
    if (!isset($smtpserver) || !isset($frommail) || !isset($psw)) {
        $errorno = 2;
        $errormsg = "没找到发件人qq信箱和密码";
    }
}
if (!$errorno && __debug__) {
    echo "smtp:$smtpserver from:$frommail psw:$psw user:$smtpusername ";
}
if (!$errorno) {
    //通过phpmailer连接smtp服务器发信
    require(dirname(__file__) . "/phpmailer/class.phpmailer.php");
    require(dirname(__file__) . "/phpmailer/class.smtp.php");
    $mail = new phpmailer();
   
    $body = $mail->getfile($mailfile);
    $body = eregi_replace("[]",'',$body);
   
    //charset
    $mail->charset = "gb2312";
   
    //$mail->smtpdebug = 2;//www.111cn.net用于显示具体的smtp错误
   
    $mail->issmtp();
    $mail->smtpauth = true;
    if ("smtp.qq.com" == trim($smtpserver)) {
        $mail->username = $frommail;
    } else {
        $mail->username = $smtpusername;
    }
    $mail->password = $psw;
    $mail->host = $smtpserver;
   
    $mail->from = $frommail;
    $mail->fromname = "晴天网络";
   
    $mail->ishtml(true);
   
    $mail->addaddress($to);
    $mail->subject = $subject;
    $mail->body = $body;
   
    if (!$mail->send()) {
   
       // echo "message could not be sent. ";
        $errorno = 3;
        $errormsg = $mail->errorinfo;
    } else {
        echo "
send to $to success use $frommail ";
        exit;
    }
}
if (3 == $errorno) {
    //记录信息,该信息地址休眠n分钟
    $content = "$frommail|" . time() . " ";//email|当前时间戳
    file_put_contents(sleeping_email, $content, file_append);
}
echo "
error no($errorno) " . $errormsg . " ";
exit;

-- php教程myadmin sql dump
-- version 2.11.6
-- http://www.phpmyadmin.net
--
-- host: localhost
-- generation time: jun 29, 2010 at 09:27 am
-- server version: 5.0.51
-- php version: 5.2.6

set sql_mode="no_auto_value_on_zero";


/*!40101 set @old_character_set_client=@@character_set_client */;
/*!40101 set @old_character_set_results=@@character_set_results */;
/*!40101 set @old_collation_connection=@@collation_connection */;
/*!40101 set names utf8 */;

--
-- database: `test`
--

-- --------------------------------------------------------

--
-- table structure for table `maillist`
--

create table if not exists `maillist` (
  `id` int(11) not null auto_increment,
  `title` text collate utf8_unicode_ci not null,
  `content` mediumtext collate utf8_unicode_ci not null,
  `senduser` varchar(50) collate utf8_unicode_ci not null,
  `sendmail` varchar(200) collate utf8_unicode_ci not null,
  `sendtime` int(11) not null,
  `accept_email` varchar(200) collate utf8_unicode_ci not null,
  `cc_email` varchar(200) collate utf8_unicode_ci not null,
  `bcc_email` varchar(200) collate utf8_unicode_ci not null,
  `msessage_id` varchar(200) collate utf8_unicode_ci not null,
  `msgno` int(11) not null comment '邮件的序号,为0表示已经下载结束',
  `is_download` tinyint(4) not null default '0',
  primary key  (`id`)
) engine=myisam default charset=utf8 collate=utf8_unicode_ci auto_increment=1 ;

--
-- dumping data for table `maillist`
--


-- --------------------------------------------------------

--
-- table structure for table `mail_account`
--

create table if not exists `mail_account` (
  `id` int(11) not null auto_increment,
  `username` varchar(100) not null,
  `password` varchar(50) not null,
  `emailaddress` varchar(100) not null,
  `mailserver` varchar(50) not null,
  `servertype` varchar(10) not null,
  `port` varchar(10) not null,
  primary key  (`id`)
) engine=myisam default charset=latin1 auto_increment=1 ;

--
-- dumping data for table `mail_account`
--


-- --------------------------------------------------------

--
-- table structure for table `mail_attach`
--

create table if not exists `mail_attach` (
  `id` int(11) not null auto_increment,
  `mail_id` int(11) not null,
  `filename` varchar(200) collate utf8_unicode_ci not null,
  `filename_tmp` varchar(200) collate utf8_unicode_ci not null,
  `download_time` datetime not null,
  primary key  (`id`)
) engine=myisam default charset=utf8 collate=utf8_unicode_ci auto_increment=1 ;

--
-- dumping data for table `mail_attach`
--

[!--infotagslink--]

相关文章

  • NodeJS实现阿里大鱼短信通知发送

    本文给大家介绍的是nodejs实现使用阿里大鱼短信API发送消息的方法和代码,有需要的小伙伴可以参考下。...2016-01-20
  • PHP测试成功的邮件发送案例

    mail()函数的作用:连接到邮件服务器,利用smtp协议,与该服务器交互并投邮件。注意:1、mail函数不支持esmtp协议,---即,只能直投,不能登陆2、由上条,我们只能直投至最终的收件服务器地址.而该地址,又是在PHP.ini中指定的,所...2015-10-30
  • php邮件发送的两种方式

    这篇文章研究的主要内容就是使用PHP来发送电子邮件,总结为以下两种方法:一、使用PHP内置的mail()函数<&#63;php $to = "test@163.com"; //收件人 $subject = "Test"; //主题 $message = "This is a test mail!"; //正文...2015-10-30
  • c# 实现发送邮件的功能

    这篇文章主要介绍了c# 如何实现发送邮件的功能,文中示例代码非常详细,帮助大家更好的理解和学习,感兴趣的朋友可以了解下...2020-07-07
  • php邮件发送的两种方式

    这篇文章研究的主要内容就是使用PHP来发送电子邮件,总结为以下两种方法:一、使用PHP内置的mail()函数<&#63;php $to = "test@163.com"; //收件人 $subject = "Test"; //主题 $message = "This is a test mail!"; //正文...2015-10-30
  • python实现企业微信定时发送文本消息的实例代码

    这篇文章主要介绍了python实现企业微信定时发送文本消息的实例代码,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2020-11-25
  • PHP测试成功的邮件发送案例

    mail()函数的作用:连接到邮件服务器,利用smtp协议,与该服务器交互并投邮件。注意:1、mail函数不支持esmtp协议,---即,只能直投,不能登陆2、由上条,我们只能直投至最终的收件服务器地址.而该地址,又是在PHP.ini中指定的,所...2015-10-30
  • php中利用curl smtp发送邮件实例

    本文章来介绍人一下关于与我们不同的发送邮件的方法我们来利用php curl stmp来实现邮件的发送程序。 $ telnet 邮箱SMTP服务地址 25 Trying 邮箱服务IP地址......2016-11-25
  • node.js 基于 STMP 协议和 EWS 协议发送邮件

    这篇文章主要介绍了node.js 基于 STMP 协议和 EWS 协议发送邮件的示例,帮助大家更好的理解和使用node.js,感兴趣的朋友可以了解下...2021-02-15
  • Python基于httpx模块实现发送请求

    这篇文章主要介绍了Python基于httpx模块实现发送请求,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下...2020-07-08
  • php定时发送邮件

    <?php // 请求 PHPmailer类 文件 require_once("class.phpmailer.php"); //发送Email函数 function smtp_mail ( $sendto_email, $subject, $body, $extra_hd...2016-11-25
  • 用PHP发送有附件的电子邮件

    我经常听到这样一个问题:"我有一个从网站发来的合同。我如何给通过表单发送的电子邮件增加一个附件呢?" 首先我要说的是要做到这个没有什么简单的办法。你要很好的理解PH...2016-11-25
  • php天翼开放平台短信发送接口实现

    临时性需求,研究了一下天翼开发平台的东西,用来发送验证码还是不错的,但是每日限额不多,所以很鸡肋,但是保证100%到达 买的话还是蛮贵的,代码没有做任何优化处理,只是测试是...2016-11-25
  • C#实现异步发送邮件的方法

    这篇文章主要介绍了C#实现异步发送邮件的方法,涉及C#异步操作与邮件发送的技巧,非常具有实用价值,需要的朋友可以参考下...2020-06-25
  • jQuery实现订单提交页发送短信功能前端处理方法

    这篇文章主要介绍了jQuery实现订单提交页发送短信功能前端处理方法,涉及jQuery响应鼠标事件及针对页面元素的样式与字符串正则操作相关技巧,需要的朋友可以参考下...2016-07-06
  • Qt实现UDP多线程数据处理及发送的简单实例

    本文主要介绍了Qt实现UDP多线程数据处理及发送的简单实例,文中通过示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-10-21
  • C++实现含附件的邮件发送功能

    这篇文章主要为大家详细介绍了C++实现含附件的邮件发送功能,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2020-04-25
  • phpmailer邮件发送实例(163邮箱 126邮箱 yahoo邮箱)

    phpmailer是一个非常优秀的php邮箱发送插件了,他可以几乎实现任何邮箱登录发送,下面我介绍163邮箱 126邮箱 yahoo邮箱的发送方法。 准备工作: 我们必须注册一个邮...2016-11-25
  • php fsockopen邮箱发送实例代码

    php教程 fsockopen邮箱发送实例代码 <? //ok的邮箱发送。 include "smtp.class.php"; //$smtps教程erver = "smtp.163.com"; //您的smtp服务器的地址 $smtps...2016-11-25
  • Asp.Net Core中发送Email的完整步骤

    这篇文章主要给大家介绍了关于Asp.Net Core中发送Email的完整步骤,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-09-22