c# - How to send email from yahoo id from my console application -
well m searching hard on google unable find working code let me send email using yahoo id on account using console application.
can body help?
you try following:
using (var client = new smtpclient("smtp.mail.yahoo.com", 587)) { client.credentials = new networkcredential("youraccount@yahoo.com", "secret"); var mail = new mailmessage(); mail.from = new mailaddress("youraccount@yahoo.com"); mail.to.add("destaccount@gmail.com"); mail.subject = "test mail"; mail.body = "test body"; client.send(mail); } and if using .net versions prior 4.0, smtpclient doesn't implement idisposable might need remove using statement around it.
Comments
Post a Comment