hi!!!
i have to send emails through MS Outlook from asp.net application..please help because i don't any idea how to do it.
thanks in advance !!
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
mathieu_cuprykPosted May 18, 2009, 11:38 PM
Mamta MPosted Oct 23, 2008, 3:09 AM
hi nandini,
This is very easy. First, import the System.Net.Mail namespace with a using statement, then write the following code:
SmtpClient sc = new SmtpClient("replace this with your SMTP host id");
//eg: SmtpClient sc = new SmtpClient("101.12.12.15");
MailMessage ms = new MailMessage("[email protected]", [email protected]);
//replace the above email ids with actual ids you want for To and From
ms.Body = "Hi"; //replace body text with actual message you want to send
ms.Subject = "test"; //replace subject with actual subject
sc.Send(ms);
Hope that helps you.
-Mamta