简体   繁体   中英

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

error : 'RandLform.Controllers.MailMessage' to '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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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