• 邮箱验证


    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Web.Mail;

    namespace Store.Common
    {/// <summary>
        /// SendEmail 的摘要说明
        /// </summary>
        public class SendEmail
        {
            public SendEmail()
            {
                //
                // TODO: 在此处添加构造函数逻辑
                //
            }

            private static string IPUrl = "http://192.168.2.127:84"; //IP地址
            //private string HeadImage = "http://192.168.2.127:84/images/head_02.gif"; //标题图片
            //private string ApplyImage = "http://192.168.2.127:84/images/mail_02.gif"; //申请信用证图片


            //private string image1 = ""; //

            #region 注册时,发送邮箱进行验证
            public static string SendEmailRegister(string UserName, string myEmail, string RadNum)
            {

                string myTitle = "感谢您注册中国货仓网会员";
                string ipUrl = "http://localhost:84/Reg/Success.aspx";  //保存链接的IP地址
                //string imageUrl = "http://192.168.2.127:84/images/";

                string temp = string.Empty;

                temp = "<html><head>";
                temp += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />";
                temp += "<title>货仓首页_中国货仓网</title>";
                temp += "<style type=\"text/css\">";
                temp += "</style>";
                temp += "</head>";
                temp += "<body>";
                temp += "<body>";
                temp += "</html>";

                try
                {
                    jmail.MessageClass MyMail = new jmail.MessageClass();//建立发邮件类
                    MyMail.Charset = "GB2312";// 字符集
                    MyMail.Encoding = "BASE64";//附件的编码格式
                    MyMail.ContentType = "text/html";
                    MyMail.ISOEncodeHeaders = false;//信头编码iso-8859-1字符集
                    MyMail.Priority = Convert.ToByte(1);//优先级
                    MyMail.From = "caiwanguo@163.com";//发送人邮件地址
                    MyMail.FromName = "yangfan";//发送人姓名

                    MyMail.Subject = myTitle;// 邮件主题
                    MyMail.MailServerUserName = "caiwanguo";//身份验证用户名
                    MyMail.MailServerPassWord = "1987312";//用户密码

                    MyMail.AddRecipient(myEmail, "", "");//收件人邮箱
                    MyMail.Body = temp;//邮件内容


                    if (MyMail.Send("smtp.163.com", false))
                    {

                        return "success";

                    }
                    else
                    {
                        return "error";

                    }

                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);

                }
                return "success";
            }
            #endregion

            #region 注册成功后,发送邮箱
            public static string SendEmailSuccess(string UserName, string myEmail, string UserPwd)
            {
                string IssueProvideInfo = IPUrl + "/Manage/Goods/SelectPage.aspx"; //发布商品供应信息
                string IssueAskInfo = IPUrl + "/Manage/Goods/SelectPage.aspx"; ; //发布商品求购信息
                string CompanyInfo = IPUrl + "/Manage/Goods/MemberBaseInfo.aspx";//发布公司介绍
                string SearchProvideInfo = "#"; //查看供应信息
                //string Forum = "#"; //进入商业论坛

                string myTitle = "感谢您注册中国货仓网会员";

                string temp = string.Empty;

                temp += "<html>";
                temp += "<head>";
                temp += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />";
                temp += "<title>货仓首页_中国货仓网</title>";
                temp += "<style type=\"text/css\">";
                temp += "</style>";
                temp += "</head>";
                temp += "<body>";
                temp += "</body>";
                temp += "</html>";
                temp += "";


                try
                {
                    jmail.MessageClass MyMail = new jmail.MessageClass();//建立发邮件类
                    MyMail.Charset = "GB2312";// 字符集
                    MyMail.Encoding = "BASE64";//附件的编码格式
                    MyMail.ContentType = "text/html";
                    MyMail.ISOEncodeHeaders = false;//信头编码iso-8859-1字符集
                    MyMail.Priority = Convert.ToByte(1);//优先级
                    MyMail.From = "caiwanguo@163.com";//发送人邮件地址
                    MyMail.FromName = "yangfan";//发送人姓名

                    MyMail.Subject = myTitle;// 邮件主题
                    MyMail.MailServerUserName = "caiwanguo";//身份验证用户名
                    MyMail.MailServerPassWord = "1987312";//用户密码

                    MyMail.AddRecipient(myEmail, "", "");//收件人邮箱
                    MyMail.Body = temp;//邮件内容


                    if (MyMail.Send("smtp.163.com", false))
                    {

                        return "success";

                    }
                    else
                    {
                        return "error";

                    }

                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);

                }
                return "success";
            }
            #endregion

            #region 发送邮箱,进行修改密码
            public static string SendEmailUpdatePwd(string UserName, string myEmail, string RadNum)
            {

                string myTitle = "感谢您注册中国货仓网会员";

                string temp = string.Empty;

                temp = "<html><head>";
                temp += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />";
                temp += "<title>货仓首页_中国货仓网</title>";
                temp += "<style type=\"text/css\">";
                  temp += "</style>";
                temp += "</head>";
                temp += "<body>";
                    temp += "<body>";
                temp += "</html>";

           

                try
                {
                    jmail.MessageClass MyMail = new jmail.MessageClass();//建立发邮件类
                    MyMail.Charset = "GB2312";// 字符集
                    MyMail.Encoding = "BASE64";//附件的编码格式
                    MyMail.ContentType = "text/html";
                    MyMail.ISOEncodeHeaders = false;//信头编码iso-8859-1字符集
                    MyMail.Priority = Convert.ToByte(1);//优先级
                    MyMail.From = "caiwanguo@163.com";//发送人邮件地址
                    MyMail.FromName = "yangfan";//发送人姓名

                    MyMail.Subject = myTitle;// 邮件主题
                    MyMail.MailServerUserName = "caiwanguo";//身份验证用户名
                    MyMail.MailServerPassWord = "1987312";//用户密码

                    MyMail.AddRecipient(myEmail, "", "");//收件人邮箱
                    MyMail.Body = temp;//邮件内容


                    if (MyMail.Send("smtp.163.com", false))
                    {

                        return "success";

                    }
                    else
                    {
                        return "error";

                    }

                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);

                }
                return "success";
            }
            #endregion
        }
    }

  • 相关阅读:
    详解vue静态资源打包中的坑与解决方案
    vue项目构建实战基础知识:SPA理解/RESTful接口介绍/static目录配置/axios封装/打包时map文件去除
    axios踩坑记录+拦截器使用+vue cli代理跨域proxy+webpack打包部署到服务器
    vue-cli项目开发/生产环境代理实现跨域请求+webpack配置开发/生产环境的接口地址
    vue中watch的用法总结以及报错处理Error in callback for watcher "checkList"
    Vue侦听器watch
    ES6 import 引用文件夹/目录及其处理过程
    Nginx部署前端代码实现前后端分离
    使用XmlInclude解决WebService调用时无法识别子类的异常
    WebServices中Xml的序列化
  • 原文地址:https://www.cnblogs.com/caiwanguo/p/932990.html
Copyright © 2020-2023  润新知