需要C#.net中的邮件认证系统 [英] need mail authetication system in C#.net

查看:86
本文介绍了需要C#.net中的邮件认证系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我需要在C#.net中发送邮件的帮助.在用户注册时,我需要的是用户应该获取用户ID和随机生成的密码到他/她的电子邮件ID,并使用它们可以登录到系统.

谢谢

Hi all

i need help in sending mail in C#.net.what i need is as the user register, the user should get the userid and random generated password to his/her email id and using that they can login to the system.

Thank you

推荐答案

其背后的想法是,

在用户表中保留说状态(位数据类型)的字段.默认为0.
当您向用户发送邮件时,请将用户ID加密为128位加密.

就像在用户电子邮件中一样,该链接会像这样
www.domainname.com/register/activate.aspx?id=OrpAirOxwkUnYoAPKWBQh9lA%2fdTTmcI8kgAAlaBW0Q5erWoFCwvDqvwzkB2g3UYa

您需要预先创建activate.aspx.在页面后面的代码中,解密ID并检查您的数据库.
返回成功后,将状态字段更新为1.
并重定向到登录页面或确认页面.

另外,您可以在已经生成并存储在数据库中的邮件正文中发送用户名和密码.

就是全部
欢呼
The idea behind this is,

Keep a fields say status (bit datatype) in user table. Default it to 0.
When you send mail to user, encrypt the userid to 128 bit encryption.

like in user email, the link will lokk like this
www.domainname.com/register/activate.aspx?id=OrpAirOxwkUnYoAPKWBQh9lA%2fdTTmcI8kgAAlaBW0Q5erWoFCwvDqvwzkB2g3UYa

You need to create the activate.aspx beforehand. In the code behind of the page, decrypt the id and check with your database.
Once success is returned, update the status field to 1.
and redirect to login page or confirmation page.

In addition, you can send the username and password in the mail body that you have already generated and stored in database.

Thats all
cheers


尝试一下:-

Try this one :-

try
      {
          MailMessage mail = new MailMessage();
          mail.To = toMail;
          mail.From = "support@xyz.com";
          mail.Subject = "Welcome to xyz!!";
          mail.Body = table;
          mail.BodyFormat = MailFormat.Html;
          mail.Priority = MailPriority.High;
          SmtpMail.SmtpServer = "localhost";
          SmtpMail.Send(mail);
      }
      catch (Exception exe)
      {

      }


http: //www.techfanas.com/2011/send-email-with-authentication-using-asp-net/ [ http://www.systemnetmail.com/faq/4.2.aspx [ http://stackoverflow.com/questions/298363/how- can-i-make-smtp-authenticated-in-c-sharp [ http://msdn.microsoft.com/en-us/library/system. net.mail.smtpclient.aspx [ ^ ]
http://www.developerfusion.com/code/5456/sending-authenticated -emails-in-net-20/ [
http://www.techfanas.com/2011/send-email-with-authentication-using-asp-net/[^]
http://www.systemnetmail.com/faq/4.2.aspx[^]
http://stackoverflow.com/questions/298363/how-can-i-make-smtp-authenticated-in-c-sharp[^]
http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx[^]
http://www.developerfusion.com/code/5456/sending-authenticated-emails-in-net-20/[^]


这篇关于需要C#.net中的邮件认证系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆