利用phpmailer 发送邮件代码[发送html内容]

我们利用 phpmailer功能实现邮件发送功能哦,这里还利用了模板呢,就是读取指定文件内容再发送给朋友.

  1. <?php 
  2. @session_start();  
  3.  include(dirname(__FILE__).'./inc/function.php'); 
  4.  require(dirname(__FILE__)."/mail/class.phpmailer.php");  
  5.  $array =  array_unique(Get_value('mail',1)); 
  6.  $type = Get_value('type',1); 
  7.   
  8.  $mail = new PHPMailer();  
  9.  $count =0;  
  10.  $bad =0; 
  11.  $mail->IsSMTP();                                      // set mailer to use SMTP 
  12.  $mail->Host = "smtp.163.com";  // smtp1.example.com;smtp2.example.comspecify main and backup server 
  13.  $mail->SMTPAuth = true;     // turn on SMTP authentication 
  14.  $mail->Username = "mailangel123";  // SMTP username 
  15.  $mail->Password = "******"// SMTP password 
  16.   
  17.  $mail->From = "mailangel123@163.com"
  18.  $mail->FromName = "你的好友来信"
  19.  $MailBody = GetContent($type); 
  20.  //$array =explode('|',$rs['mail']); 
  21.  foreach$array as $tmpmail ){ 
  22.   if( @preg_match("/w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*/",$tmpmail
  23.    || strlen($User_Mail)<6 ) 
  24.   { 
  25.    $mail->AddReplyTo("mailangel123@163.com""44"); 
  26.    $mail->AddAddress($tmpmail,'您好!'); 
  27.    $mail->WordWrap = 50; 
  28.    $mail->CharSet="GB2312";                                  
  29.    //$mail->AddAttachment("/var/tmp/file.tar.gz");         
  30.    //$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    
  31.    $mail->IsHTML(true);                             
  32.     
  33.    $mail->Subject = "你的朋友邀请你一起合影!"
  34.    $mail->Body    = $MailBody
  35.     
  36.    if(!$mail->Send()) 
  37.    { 
  38.       $bad++; 
  39.       $mail->ClearAddresses();    
  40.       $mail->ClearAttachments();  
  41.        
  42.    } 
  43.    else 
  44.    { 
  45.     $count++; 
  46.    } 
  47.   } 
  48.   ShowMsg("result:$count"); 
  49.    
  50.  } 
  51. 下面这个文章是读取html 文档并进行html发送哦, 
  52.   
  53.  function GetContent($type){ 
  54.   if$type ) 
  55.   { 
  56.    if(file_exists('./mail_room.html') ) 
  57.    { 
  58.     $content = file_get_contents'./mail_room.html'); 
  59.    } 
  60.    else 
  61.    { 
  62.     ShowMsg('file can' read fail '); 
  63.    } 
  64.   } 
  65.   else 
  66.   { 
  67.    iffile_exists'./mail_person.html') ) 
  68.    { 
  69.     $content = file_get_contents'./mail_person.html'); 
  70.    } 
  71.    else 
  72.    { 
  73.     ShowMsg('person file read fail!'); 
  74.    } 
  75.     
  76.   } 
  77.   return $content
  78.  } 
  79.  /* echo "<script>alert('发关".$count."邮件成功');</script>"; */ 
  80. ?> 
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!

波比源码 » 利用phpmailer 发送邮件代码[发送html内容]

62 评论

  1. sildenafil 100mg cost careprost pills order methocarbamol sale

  2. buy lamotrigine 50mg without prescription mebendazole medication order tretinoin cream generic

  3. buy prednisone 5mg buy 5mg cialis buy generic sildenafil 100mg

  4. doxycycline 100mg pills clomid drug furosemide canada

  5. order provera without prescription periactin 4mg ca periactin for sale online

  6. order generic sildenafil 50mg cialis 5 mg buy cialis for sale

  7. lasix 40mg pill lasix generic buy plaquenil 200mg generic

  8. naprosyn order online cefdinir medication order prevacid 15mg without prescription

  9. real money casino online usa casino free spin online blackjack spins website

  10. buy dapoxetine generic avana uk buy motilium 10mg generic

  11. After all, what a great site and informative posts, I will upload inbound link – bookmark this web site? Regards, Reader. Metropol Halı Karaca Halı Öztekin ve Selçuklu Halı Cami Halısı ve Cami Halıları Türkiye’nin En Büyük Cami Halısı Fabrikasıyız…

  12. buy fenofibrate 200mg pills viagra cheap order sildenafil 50mg sale

  13. order ondansetron 4mg generic zofran price cost trimethoprim

发表评论

Hi, 如果你对这款模板有疑问,可以跟我联系哦!

联系站长
赞助VIP 享更多特权,建议使用 QQ 登录
喜欢我嘛?喜欢就按“ctrl+D”收藏我吧!♡