简体   繁体   English

转换为 system.net.mail.mailMessage 错误

[英]converting to system.net.mail.mailMessage error

i'm actually trying to create registration page with verfication mail using MVC in visual studio, but here to send a message im getting我实际上是在尝试在 Visual Studio 中使用 MVC 创建带有验证邮件的注册页面,但在这里发送一条消息

error : 'RandLform.Controllers.MailMessage' to 'System.Net.Mail.MailMessage' RandLform错误:“RandLform.Controllers.MailMessage”到“System.Net.Mail.MailMessage”RandLform

public void SendVerficationLinkEmail(string emailID, string activationCode)
{
    var VerifyUrl = "/User/VerifyAccount/" + activationCode;

    var link = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, VerifyUrl);

    var fromEmail = new MailAddress("lokeshkingdom4u@gmail.com", "Lokesh Pladugula");

    var toEmail = new MailAddress(emailID);

    var fromEmailPassword = "paisa007";

    string subject = "Account created Succesfully!";

    string body = "<br/>To verify your account, click on below link.<br/><br/> "+" <a href = "+link+"> "+link+"</a>";

    var smtp = new SmtpClient
    {
        Host = "smtp.gmail.com",
        Port = 587,
        EnableSsl = true,
        DeliveryMethod = SmtpDeliveryMethod.Network,
        UseDefaultCredentials = false,
        Credentials = new NewNetworkCredential(fromEmail.Address, fromEmailPassword)

    };

    using (var message = new MailMessage(fromEmail, toEmail)
    {
        Subject = subject,
        Body = body,
        IsBodyHtml = true
    }) 
    smtp.Send(message);
}

Lokesh Paladugula,洛凯什·帕拉杜古拉

I recommend you to change password of your email account.我建议您更改电子邮件帐户的密码。

I'm not sure if this is actual error, please send proper error.我不确定这是否是实际错误,请发送正确的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM