lundi 25 janvier 2016

How to Send Mail Without using Password

I want to sent mail without using password of the mailid,Currently i use this code to sent mail.....i hardcode the mail id and pwd

i want to pass the frommail and tomail as parameter, and i dont want a password to send a mail

        System.Net.NetworkCredential cred = new System.Net.NetworkCredential("demo@outlook.com", "demo1234");
        SmtpClient smtp = new SmtpClient("smtp-mail.outlook.com", 587);
        smtp.EnableSsl = true;
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtp.UseDefaultCredentials = false;
        smtp.Credentials = cred;
        smtp.Send(message);

Please Help Me

Aucun commentaire:

Enregistrer un commentaire