求救带参数的传递 邮件

 

                jmail.Message msg = new jmail.MessageClass();
                msg.Subject = "恭喜你成为CSDN俱乐部成员!";

                读取txt文件的内容,给msg.Body
                Stream stream = File.OpenRead(Server.MapPath("~/") + "touch.txt"); //网站上有touch.txt
                StreamReader reader = new StreamReader(stream, Encoding.UTF8);
                string a = reader.ReadToEnd();
                stream.Close();
                reader.Close();

                //写入数据流
                FileStream stream1 = new FileStream(Server.MapPath("~/") + "write.txt", FileMode.Create, FileAccess.Write);
                StreamWriter writer = new StreamWriter(stream1);

                Random ran = new Random(DateTime.Now.Millisecond);
                StringBuilder sb = new StringBuilder(4);
                for (int i = 0; i < 4; i++)
                {
                    sb.Append(ran.Next(0, 9));
                }

                string c = sb.ToString();
                writer.Write("<br/>"+"你的CSDN帐号是:" + this.txt_username.Text+"<br/>"+"激活码是:"+sb.ToString()+"<a href='http://localhost:9696/registered/shock.aspx'>现在就去激活</a>");//将激活码、用户名输入到write.text里面 ,并且写一段html代码 将产生的激活码,如何传送到本计算机服务器中的shock.aspx页面里
                writer.Close();
                stream1.Close();

                读取txt文件的内容,给msg.Body
                Stream stream3 = File.OpenRead(Server.MapPath("~/") + "write.txt");
                StreamReader reader2 = new StreamReader(stream3, Encoding.UTF8);
                string b = reader2.ReadToEnd();
                stream.Close();
                reader.Close();


                msg.Body = a+b;

                msg.From = "yvi312082007@163.com";
                msg.AddRecipient(this.txt_mail.Text);
                msg.MailServerUserName = "yvi312082007@163.com";
                msg.MailServerPassWord = "邮箱密码";
                msg.Charset = "utf-8";
                msg.ContentType = "text/html";
                msg.Send("smtp.163.com");

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值