您的位置:程序门 -> .net技术 -> asp.net



如何向注册用户邮箱自动发送帐号和密码


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


如何向注册用户邮箱自动发送帐号和密码[已结贴,结贴人:wonechao]
发表于:2007-08-21 15:43:07 楼主
如题,在线等!
发表于:2007-08-21 15:47:211楼 得分:5
system.net.mail
发表于:2007-08-21 15:50:312楼 得分:0
谢谢,不过能说得详细点吗?因为是首次接触的,不大懂怎么开始?
发表于:2007-08-21 16:14:553楼 得分:5
用户注册完了就发送他的相关内容编辑发到他的邮箱呗
baidu搜索   asp.net邮件发送     很多答案的
发表于:2007-08-21 16:25:014楼 得分:10
public   static   bool   send(string   emailto,   string   subject,   string   content)
        {
                bool   success   =   true;

                #region   ---   用system.net.mail发送邮件   ---

                #region   ---   发送邮件的相关信息设置   ---

                string   host   =   configurationmanager.connectionstrings[ "host "].tostring();   //邮件服务器
                string   emailuser   =   configurationmanager.connectionstrings[ "fromuser "].tostring();   //发件人邮箱登录帐号
                string   emailpassword   =   configurationmanager.connectionstrings[ "fromcode "].tostring();   //发件人邮箱登录密码
                string   emailfrom   =   configurationmanager.connectionstrings[ "from "].tostring();   //发件人邮箱

                #endregion

                if   (emailto   ==   " "   ¦ ¦   emailto   ==   null)
                {
                        success   =   false;
                }
                else
                {
                        system.net.mail.smtpclient   client   =   new   smtpclient();
                        client.host   =   host;
                        client.usedefaultcredentials   =   false;
                        client.credentials   =   new   system.net.networkcredential(emailuser,   emailpassword);

                        client.deliverymethod   =   smtpdeliverymethod.network;
                        system.net.mail.mailmessage   message   =   new   mailmessage(emailfrom,   emailto);
                        message.subject   =   subject;   //邮件标题
                        message.body   =   content;   //邮件内容
                        message.bodyencoding   =   system.text.encoding.utf8;
                        message.isbodyhtml   =   true;


                        try
                        {
                                client.send(message);
                        }
                        catch   (exception   ex)
                        {
                                success   =   false;
                        }
                }
                return   success;
发表于:2007-08-21 17:18:585楼 得分:0
谢谢大家,问题解决了!!!!


快速检索

最新资讯
热门点击