iis6newbie
Technical User
Hello all,
I have the following code in vb.net. I would like to convert to c# .NET. Can someone help me?
Set Mail = CreateObject ("CDOMail.CSendMail") ' in vb.net
Thanks
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Chip H.msdn said:try
{
try
{
MailMessage Message = new MailMessage();
Message.To = "someone@example.com";
Message.From = "you@example.com";
Message.Subject = "test msg";
Message.Body = "body goes here";
try
{
SmtpMail.SmtpServer = "your mail server name goes here";
SmtpMail.Send(Message);
}
catch(System.Web.HttpException ehttp)
{
Console.WriteLine("{0}", ehttp.Message);
Console.WriteLine("Here is the full error message output");
Console.Write("{0}", ehttp.ToString());
}
}
catch(IndexOutOfRangeException)
{
// Show proper usage
}
}
catch(System.Exception e)
{
Console.WriteLine("Unknown Exception occurred {0}", e.Message);
Console.WriteLine("Here is the Full Message output");
Console.WriteLine("{0}", e.ToString());
}