找回密码
 注册成为天翎用户
查看: 1057|回复: 2

[已解决] 发送邮件可否包含图片

[复制链接]
大麦 发表于 2016-5-10 16:53:53 | 显示全部楼层 |阅读模式
本帖最后由 karrman 于 2016-12-15 12:09 编辑

用户在表单中的一个字段上传了图片,现在想将图片作为邮件内容发送到相关人员
wander 发表于 2016-5-11 18:08:02 | 显示全部楼层
邮件中的内容可以以HTML文档的形式发送,把图片嵌入到HTML文档中
回复

使用道具 举报

karrman 发表于 2016-12-15 12:08:55 | 显示全部楼层
  1. (function(){
  2.         var yx = "";
  3.         var date = getToday();
  4.         date = format(date,"yyyy-MM-dd");
  5.         
  6.                 var sql = "select a.domainid,item_项目名称,item_负责人,item_预算成本, (select sum(ITEM_金额) as item_金额 from tlk_临时费用登记 where ITEM_所属项目 = a.ITEM_项目名称) item_临时费用, (select sum(ITEM_成本) as item_金额 from tlk_工作日报 where ITEM_所属项目 = a.ITEM_项目名称) item_人工费用 from tlk_项目信息 a where item_项目状态<>'已完成' GROUP BY ITEM_项目名称";
  7.                                 var process1 = getDocProcess('11e6-2d1c-908d1c9b-abde-35dbfa83876a');//application           
  8.                                 var datas = process1.queryBySQL(sql, '11e1-81e2-37f74759-9124-47aada6b7467');
  9.                                 datas = datas.getDatas();
  10.                                 //var datas = queryBySQL(sql);
  11.                                 var html = "";
  12.                                 var html="<table cellSpacing='0' cellPadding='1' width='100%' align='center' style='border:solid #cccccc;border-width:2px 0px 0px 2px;'>"
  13.                                                 +"<tbody><tr style='line-height:22px;'>"
  14.                                                 +"<td width=30%'  style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >项目名称</td>"
  15.                                                 +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'  >负责人</td>"
  16.                                                 +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >预算成本</td>"
  17.                                                 +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >人工费用</td>"
  18.                                                 +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >临时费用</td>"
  19.                                                 +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >合计</td>"
  20.                                                 +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >剩余费用</td></tr>";           

  21.                                 if(datas != null){
  22.                                         for(var iter = datas.iterator();iter.hasNext();){
  23.                                        
  24.                                                 var doc = iter.next();
  25.                                                 var pname = doc.getItemValueAsString("项目名称");  
  26.                                                 var fzr = doc.getItemValueAsString("负责人");
  27.                                                 var fzrname=getUserById(fzr).getName();
  28.                                                 var ys = doc.getItemValueAsDouble("预算成本");
  29.                                                 ys=round(ys,2);
  30.                                                 var rgfy = doc.getItemValueAsDouble("人工费用");
  31.                                                 rgfy=round(rgfy,2);
  32.                                                 var lsfy = doc.getItemValueAsDouble("临时费用");
  33.                                                 lsfy=round(lsfy,2);
  34.                                                 var hj = rgfy+lsfy;
  35.                                                 hj=round(hj,2);
  36.                                                 var syfy = ys-hj;
  37.                                                 syfy=round(syfy,2);
  38.                                                 
  39.                                           
  40.                                                 html += "<tr style='line-height:22px;'>"
  41.                                                 +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+pname+"</td>"
  42.                                                 +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+fzrname+"</td>"
  43.                                                 +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;text-align:right'>"+ys+"</td>"
  44.                                                 +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;text-align:right'>"+rgfy+"</td>"
  45.                                                 +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;text-align:right'>"+lsfy+"</td>"
  46.                                                 +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;text-align:right'>"+hj+"</td>"
  47.                                                 +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;text-align:right'>"+syfy+"</td>"
  48.                                                 +"</tr>";
  49.             
  50.                                         }
  51.                                         html += "</tbody></table>"
  52.                                 }
  53.                                 println("---------html----------------------"+html);
  54.                         var sql1 = "select email as item_邮箱,domainid from obpm.t_user where id in(select b.USERID from obpm.t_user_role_set b where b.roleid = (select a.id from obpm.t_role a where a.NAME ='项目总经理') )";
  55.                         var datas1 = process1.queryBySQL(sql1, '11e1-81e2-37f74759-9124-47aada6b7467');  //domainid   
  56.                         datas1 = datas1.getDatas();
  57.                         //var datas1 = queryBySQL(sql1);
  58.                         if(datas1 != null){
  59.                                 for(var iter = datas1.iterator();iter.hasNext();){
  60.                                 var doc1 = iter.next();
  61.                                 var yx = doc1.getItemValueAsString("邮箱");
  62.                                 println("---------yx----------------------"+yx);
  63.                                         var first="您好!截止至"+date+","+"公司项目费用明细如下表所示:<br><br>";
  64.                                         var last="<br>温馨提示:以上数据由系统定时自动导出,如有疑问请登录http://查询。"
  65.                                         var body = first+html+last;
  66.                                         var subject = "项目费用报表"+"("+date+")";
  67.                                         var to = yx;
  68.                                         var from1 = "5454566.com";
  69.                                         var host = "smtp.exmail.qq.com";
  70.                                         var user = "s345656@weioa365.com";
  71.                                         var password1 = "已uyiuyiuyui";
  72.                                         var bbc = "";
  73.                                         var validate = true;
  74.                                         var files = new Array("");
  75.                                         sendMail(from1,to,subject,body,host,user,password1,bbc,validate);        
  76.                           }
  77.                    }                        
  78. })();


  79. //80.10
复制代码
回复

使用道具 举报

本版积分规则

手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-14 02:21

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表